Part Number Hot Search : 
HMC941 2SK237 24LC00 IRFS710B LBN09006 NRA24T15 SRV05 MSZ5241
Product Description
Full Text Search
 

To Download S3C3410X Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  22 - s3-c3410x-062001 user's manual S3C3410X 16 -bit cmos microcontroller s revision 2
notification of revisions originator: samsung electronics, soc development group, ki-heung, south korea product name: S3C3410X risc microcontroller document name: S3C3410X user's manual, revision 2 document number: 22-s3-c3410x-06-2001 effective date: june, 2001 summary: as a result of additional product testing and evaluation, to correct the errata and to add more detailed explanations, some specifications published in the S3C3410X user's manual, revision 1, have been changed. these changes for S3C3410X microcontroller, which are described in detail in the revision descriptions section below, are related to the followings: ? chapter 1. pin descriptions ? chapter 4. extconx, extport, extdatx and timing diagrams ? chapter 5. cache disable opera tion ? chapter 7. port 7 and port 9 control registers ? chapter 11. interrupt priority register ( intprix) ? chapter 14. multi-master iic-bus status register (iicstat) directions: please note the changes in your copy (copies) of the S3C3410X user's manual, revision 1. or, simply attach the revision descriptions of the next page to S3C3410X user's manual, revision 1. revision history revision date remark 0 ? there is no preliminary spec. 1 august, 2000 reviewed by gwang-su han. 2 june, 2001 reviewed by gwang-su han.
revision descriptions 1. pin descriptions: 1) pin descriptions about a[23:0], d[15:0], ncs[7:0] necs[1:0], nwait and nwrexp, are changed and the content of rp[7:0] are added. S3C3410X user's manual reference: table 1-3, page 1-11 2) the following errata should be corrected: rxd ? urxd, txd ? utxd, siock[1:0] ? sioclk[1:0], extai0 ? extal0, syscfg0 ? syscfg, memconx ? bankconx, edvconx ? extconx, extdatax ? extdatx , utxhw ? utxh_w, urxhw ? urxh_w, iicadd(0xe002) ? iicadd(0xe003), iicds(0xe003) ? iicds(0xe002) S3C3410X user's manual reference: table 1-3, page 1-11 2. extconx, extport, extdatx and timing diagrams: 1) contents about extconx, extport, and extdatx are changed. S3C3410X user's manual reference: page 4-14 and page 4-15 2) "multiplexed address mode timing diagrams", " ncs timing diagram with nwait", and ? necs timing diagram with nwait" are added. 3) external device interface diagram is changed. S3C3410X user's manual reference: figure 4-21, page 4-30 3. cache disable operation: 1) more detailed explanations about the internal sram address (when the cache is disabled) is added. S3C3410X user's manual reference: page 5-4 4. port 7 and port 9 control registers: 1) the contents of p7br(0xb00b) is added in port 7 and the pin descriptions of p7.x are changed to p7.x ( rpx). S3C3410X user's manual reference: page 7-20 2) more detailed explanations about p9.0(lp) and p9.1(dclk) are added. S3C3410X user's manual reference: page 7-25 (continued to the next page)
5. interrupt priority register: 1) the contents about the intprix are changed . S3C3410X user's manual reference: page 11-10 6. multi-master iic-bus status register: 1) the contents of intflag is added to iicstat register. S3C3410X user's manual reference: page 14-7 2) the prescaler value (4 ( prescaler value + 1)) is changed to (16 ( prescaler value + 1)) in iicps. S3C3410X user ?s manual reference: page 14-9
S3C3410X risc microprocessor product overview 1- 1 1 product overview introduction samsung's S3C3410X 16/32-bit risc microcontroller is a cost-effective and high-performance microcontroller solution for pda and general purpose application. an outstanding feature of the S3C3410X is its cpu core, a 16/32-bit risc processor(arm7tdmi) designed by advanced risc machines, ltd. the arm7tdmi core is a low-power, general purpose, microprocessor macro- cell, which was developed for the use in application-specific and customer-specific integrated circuits. its simple, elegant, and fully static design is particularly suitable for cost-sensitive and power-sensitive application. the S3C3410X has been developed by using the arm7tdmi core, cmos standard cell, and a data path compiler. most of the on-chip function blocks have been designed using an hdl synthesizer. the S3C3410X has been fully verified in samsung asic test environment including the internal qualification assurance process. by providing a complete set of common system peripherals, the S3C3410X can minimize the overall system cost and eliminates the need to configure additional components, externally. the integrated on-chip functions which are described in this document include: integrated external memory controller (rom/sram and fp/edo dram/sdram controller) 2-channel general dma controller internal 4k-byte memory can be configured as (4kb cache only), (2kb cache and 2kb sram), or (4kb sram only). 1-channel uart with irda 1.0, 1-channel iic, and 2-channel sio(synchronous serial io) 3-channel 16-bit timers and 2-channel 8-bit timers real time clock with calendar function. crystal/ceramic oscillator or external clock can be used as the clock source. power control: normal, idle, and stop mode 1-channel 8-bit basic timer and 3-bit watch-dog timer interrupt controller: 35 interrupt sources, interrupt priority control logic and interrupt vector generation by h/w. 8-channel 10-bit adc 10 programmable i/o port group (total 74 i/o ports including the multiplexed i/o)
product overview s3 c3410x risc microprocessor 1- 2 features architecture integrated system for hand-held and general embedded application. fully 16/32-bit risc architecture(32-bit arm instruction as well as 16-bit thumb instruction). arm7tdmi cpu core, supporting the efficient and powerful instruction set. on-chip icebreaker tm debug support by jtag- based solution. 4kb unified cache (instruction/data cache memory) system manager address space: 16mbytes per each bank (total 128mbyte) support 8-bit/16-bit data bus width for external memory/device access. the bank can support rom/sram/flash, external i/o device or fp/edo/sdram. among total 8 memory banks, bank0,1,2,3,4 and 5 can be mapped to rom/sram/flash, while bank6 and 7 can be mapped to fp/edo/sdram as well as rom/sram/flash. fully programmable access cycle for all memory banks support s self-refresh/auto-refresh mode to retain the data in the dram. two external i/o banks can be mapped to the sfr (special function register) region. unified(instruction/data) cache memory & internal sram two-way set associative 4kb cache. pseudo lru (least recently used) replacement policy. four depth write buffer. programmable configuration of (4kb cache, only), (2kb cache and 2kb sram), or (4kb sram, only). dma controller two-channel general purposed dma(direct memory access) controller. the data transfer of memory-to-memory, serial port-to-memory, memory-to-serial port, memory- to-sfr(special function register), sfr-to- memory, internal sram-to-memory, and memory-to-internal sram without cpu intervention initiated by the software or external dma request increment or decrement source or destination addresses. supports 8-bit(byte), 16-bit(half-word), and 32- bit(word) of data transfer size. i/o ports 10 programmable input, output, and i/o port group (74 i/o ports including the multiplexed i/o) one programmable output port (2-bit multiplexed output ports) one programmable input port(8-bit multiplexed input ports) eight programmable i/o port group. 16-bit timer/counters (t0, t1, t2) three-channel programmable 16-bit timer/counter interval, capture, match & overflow, or dma mode operation internal or external clock source 8-bit timer/counters (t3, t4) two-channel programmable 8-bit timer/counter interval, capture, pwm, or dma mode operation (t4 pwm with 5-byte fifo buffer, which can provide the sound generation capability) internal or external clock source
S3C3410X risc microprocessor product overview 1- 3 uart & sio one-channel uart with dma-based or interrupt-based operation programmable baud rates supports 5-bit, 6-bit, 7-bit and 8-bit serial data transmit/receive frame in uart programmable accessible 8-byte transmitter fifo and 8-byte receiver fifo in uart two-channel synchronous sio with dma-based or interrupt-based operation support the serial data transmit/receive operation by 8-bit frame. interrupt controller 35 interrupt sources (12 external interrupt, 2 dma, 3 uart, 11 timer, adc, iic, 2 sio, basic timer, 2 rtc) h/w interrupt priority logic and vector generation normal or fast interrupt modes (irq, fiq) a/d converter eight-channel multiplexed adc successive approximation conversion 10-bit adc wdt(watch-dog timer) and basic timer 8-bit counter (basic timer) and 3-bit counter (watchdog timer) the overflow signal of 8-bit counter can generate a basic timer interrupt and should be input clock for 3-bit counter(watchdog timer). the overflow signal of 3-bit counter makes a system reset iic bus interface one-channel multi-master iic-bus support 8-bit, bi-directional, and serial data transfer up to 100kbit/s. rtc (real time clock) full clock function : second, minute, hours, day, week, month, and year 32.768khz operation alarm interrupt for cpu wake-up power down mode power mode: idle, slow and stop mode system clock division ratio in slow mode: 1, 1/2, 1/8, 1/16, and 1/1024 operating voltage range 3.0 v to 3.6 v temperature range 0 o c to 70 o c operating frequency up to 40mhz package type 128-pin qfp
product overview s3 c3410x risc microprocessor 1- 4 block diagram system clock circuit basic timer & wdt a/d converter dma0,1 uart serial i/o 0,1 interrupt controller real time clock generator gpio controller timer 0,1,2,3,4 system bus controller bus arbitration bus interface rom/ flash/sram controller fp/dram/ sdram controller general purpose i/o ports general purpose i/o ports crystal/ ceramic oscillator system bus iic bus write buffer arm7tdmi cpu core cache 4 kbyte cpu unit figure 1-1. S3C3410X block diagram
S3C3410X risc microprocessor product overview 1- 5 pin assignments ain3/p8.3 ain2/p8.2 ain1/p8.1 ain0/p8.0 avref adcv ss extal1 xtal1 rtcv dd test1 test0 nreset extal0 xtal0 rp7/p7.7 rp6/p7.6 v dd v ss rp5/p7.5 tdo/rp4/p7.4 ntrst/rp3/p7.3 tdi/rp2/p7.2 tms/rp1/p7.1 tck/rp0/p7.0 eint3/p6.7 siotxd1/p6.6 a19/p1.3 a20/eint4/p1.4 a21/eint5/p1.5 a22/eint6/p1.6 a23/eint7/p1.7 ncs0 ncs1/p2.0 ncs2/p2.1 ncs3/p2.2 ncs4/p2.3 ncs5/p2.4 ncs6:nras0:nscs0/p2.5 v ss v dd ncs7:nras1:nscs1/p2.6 eint1/necs0/p2.7 noe nas nwbe0:nbe0:dqm0/p3.0 nwbe1:nbe1:dqm1/p3.1 ncas0:nsras/p3.2 ncas1:nscas/p3.3 nwe/p3.4 scke/p3.5 sclk/p3.6 eint2/necs1/p3.7 sioclk1/p6.5 siorxd1/p6.4 siordy/nwait/p6.3 siotxd0/p6.2 sioclk0/p6.1 siorxd0/p6.0 utxd/p5.7 urxd/p5.6 v dd v ss iicsck/p5.5 iicsda/p5.4 ndack1/p5.3 ndreq1/p5.2 ndack0/p5.1 ndreq0/p5.0 d15/a23/p4.7 d14/a22/p4.6 v dd v ss d13/a21/p4.5 d12/a20/p4.4 d11/a19/p4.3 d10/a18/p4.2 d9/a17/p4.1 d8/a16/p4.0 d7 d6 v dd v ss d5 d4 d3 d2 d1 d0 dclk/p9.1 lp/p9.0 ain4/eint8/p8.4 ain5/eint9/p8.5 ain6/eint10/p8.6 ain7/eint11/p8.7 adcv dd tclk0/tcap0/p0.0 tclk1/tcap1/p0.1 tclk2/tcap2p0.2 v ss v dd tclk3/p0.3 tclk4/p0.4 tcap3/tout3/pwm0/p0.5 tcap4/tout4/pwm1/p0.6 eint0/nwrexp/p0.7 a0 a1 a2 v ss v dd a3 a4 a5 a6 a7 a8/a16 a9/a17 a10/a18 v ss v dd a11/a19 a12/a20 a13/a21 a14/a22 a15/a23 a16/p1.0 a17/p1.1 a18/p1.2 S3C3410X (128-qfp-1420) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 figure 1-2. S3C3410X pin assignments
product overview s3 c3410x risc microprocessor 1- 6 table 1-1. 128-pin qfp pin assignment pin no function i/o state @initial i/o type reset 1 ain4/eint8/p8.4 i piseuc p8.4 2 ain5/eint9/p8.5 i piseuc p8.5 3 ain6/eint10/p8.6 i piseuc p8.6 4 ain7/eint11/p8.7 i piseuc p8.7 5 adcvdd p vddt 6 tclk0/tcap0/p0.0 io pbseuct4 p0.0 7 tclk1/tcap1/p0.1 io pbseuct4 p0.1 8 tclk2/tcap2/p0.2 io pbseuct4 p0.2 9 vss p vss 10 vdd p vdd 11 tclk3/p0.3 io pbseuct4 p0.3 12 tclk4/p0.4 io pbseuct4 p0.4 13 tcap3/tout3/pwm0/p0.5 io pbseuct4 p0.5 14 tcap4/tout4/pwm1/p0.6 io pbseuct4 p0.6 15 eint0/nwrexp/p0.7 io pbseuct8 p0.7 16 a0 o pob8 a0 17 a1 o pob8 a1 18 a2 o pob8 a2 19 vss p vss 20 vdd p vdd 21 a3 o pob8 a3 22 a4 o pob8 a4 23 a5 o pob8 a5 24 a6 o pob8 a6 25 a7 o pob8 a7 26 a8/a16 o pob8 a8 27 a9/a17 o pob8 a9 28 a10/a18 o pob8 a10 29 vss p vss 30 vdd p vdd 31 a11/a19 o pob8 a11 32 a12/a20 o pob8 a12
S3C3410X risc microprocessor product overview 1- 7 table 1-1. 128-pin qfp pin assignment (continued) pin no function i/o state @initial i/o type reset 33 a13/a21 o pob8 a13 34 a14/a22 o pob8 a14 35 a15/a23 o pob8 a15 36 a16/p1.0 io pbcedct8 p1.0 37 a17/p1.1 io pbcedct8 p1.1 38 a18/p1.2 io pbcedct8 p1.2 39 a19/p1.3 io pbcedct8 p1.3 40 a20/eint4/p1.4 io pbsedct8 p1.4 41 a21/eint5/p1.5 io pbsedct8 p1.5 42 a22/eint6/p1.6 io pbsedct8 p1.6 43 a23/eint7/p1.7 io pbsedct8 p1.7 44 ncs0 o pob8 ncs0 45 ncs1/p2.0 io pbceuct8 p2.0 46 ncs2/p2.1 io pbceuct8 p2.1 47 ncs3/p2.2 io pbceuct8 p2.2 48 ncs4/p2.3 io pbceuct8 p2.3 49 ncs5/p2.4 io pbceuct8 p2.4 50 ncs6:nras0:nscs0/p2.5 io pbceuct8 p2.5 51 vss p vss 52 vdd p vdd 53 ncs7:nras1:nscs1/p2.6 io pbceuct8 p2.6 54 eint1/necs0/p2.7 io pbseuct8 p2.7 55 noe o pob8 noe 56 nas o pob8 nas 57 nwbe0:nbe0:dqm0/p3.0 io pbceuct8 p3.0 58 nwbe1:nbe1:dqm1/p3.1 io pbceuct8 p3.1 59 ncas0:nsras/p3.2 io pbceuct8 p3.2 60 ncas1:nscas/p3.3 io pbceuct8 p3.3 61 nwe/p3.4 io pbceuct8 p3.4 62 scke/p3.5 io pbceuct8 p3.5 63 sclk/p3.6 io pbceuct8 p3.6 64 eint2/necs1/p3.7 io pbseuct8 p3.7
product overview s3 c3410x risc microprocessor 1- 8 table 1-1. 128-pin qfp pin assignment (continued) pin no function i/o state @initial i/o type reset 65 lp/p9.0 o pob8 lp 66 dclk/p9.1 o pob8 dclk 67 d0 io pbcedct8 d0 68 d1 io pbcedct8 d1 69 d2 io pbcedct8 d2 70 d3 io pbcedct8 d3 71 d4 io pbcedct8 d4 72 d5 io pbcedct8 d5 73 vss p vss 74 vdd p vdd 75 d6 io pbcedct8 d6 76 d7 io pbsedct8 d7 77 d8/a16/p4.0 io pbcedct8 p4.0 78 d9/a17/p4.1 io pbcedct8 p4.1 79 d10/a18/p4.2 io pbcedct8 p4.2 80 d11/a19/p4.3 io pbcedct8 p4.3 81 d12/a20/p4.4 io pbcedct8 p4.4 82 d13/a21/p4.5 io pbcedct8 p4.5 83 vss p vss 84 vdd p vdd 85 d14/a22/p4.6 io pbcedct8 p4.6 86 d15/a23/p4.7 io pbcedct8 p4.7 87 ndreq0/p5.0 io pbceuct4 p5.0 88 ndack0/p5.1 io pbceuct4 p5.1 89 ndreq1/p5.2 io pbceuct4 p5.2 90 ndack1/p5.3 io pbceuct4 p5.3 91 iicsda/p5.4 io pbceuct8 p5.4 92 iicsck/p5.5 io pbceuct8 p5.5 93 vss p vss 94 vdd p vdd 95 urxd/p5.6 io pbceuct4 p5.6 96 utxd/p5.7 io pbceuct4 p5.7
S3C3410X risc microprocessor product overview 1- 9 table 1-1. 128-pin qfp pin assignment (continued) pin no function i/o state @initial i/o type reset 97 siorxd0/p6.0 io pbseuct4 p6.0 98 sioclk0/p6.1 io pbseuct4 p6.1 99 siotxd0/p6.2 io pbseuct4 p6.2 100 siordy/nwait/p6.3 io pbseuct4 p6.3 101 siorxd1/p6.4 io pbseuct4 p6.4 102 sioclk1/p6.5 io pbseuct4 p6.5 103 siotxd1/p6.6 io pbseuct4 p6.6 104 eint3/p6.7 io pbseuct4 p6.7 105 tck/rp0/p7.0 io pbceuct4 p7.0 106 tms/rp1/p7.1 io pbceuct4 p7.1 107 tdi/rp2/p7.2 io pbceuct4 p7.2 108 ntrst/rp3/p7.3 io pbceuct4 p7.3 109 tdo/rp4/p7.4 io pbceuct4 p7.4 110 rp5/p7.5 io pbceuct4 p7.5 111 vss p vss 112 vdd p vdd 113 rp6/p7.6 io pbceuct4 p7.6 114 rp7/p7.7 io pbceuct4 p7.7 115 xtal0 i oscm xtal0 116 extal0 o oscm extal0 117 reset i pisu reset 118 test0 i pis test0 119 test1 i pis test1 120 rtcvdd p vddt 121 xtal1 i oscm xtal1 122 extal1 o oscm extal1 123 adcvss p vsst 124 avref a apad avref 125 ain0/p8.0 i piseuc p8.0 126 ain1/p8.1 i piseuc p8.1 127 ain2/p8.2 i piseuc p8.2 128 ain3/p8.3 i piseuc p8.3
product overview s3 c3410x risc microprocessor 1- 10 table 1-2. i/o type description i/o type description vdd, vss 3.3v vdd/vss vddt, vsst 3.3v vdd/vss for analog circuitry pbceuct4 bi-direction pad, cmos level, pull-up resister with control, tri-state, io = 4ma pbseuct4 bi-direction pad, cmos schmitt-trigger, pull-up resister with control, tri-state, io = 4ma pbceuct8 bi-direction pad, cmos level, pull-up resister with control, tri-state, io = 8ma pbseuct8 bi-direction pad, cmos schmitt-trigger, pull-up resister with control, tri-state, io = 8ma pbcedct8 bi-direction pad, cmos level, pull-down resister with control, tri-state, io = 8ma pbsedct8 bi-direction pad, cmos schmitt-trigger, pull-down resister with control, tri-state, io = 8ma pob8 output pad, io = 8ma pis input pad, cmos schmitt-trigger pisu input pad, cmos schmitt-trigger, pull-up resister piceuc input pad, cmos level, pull-up resister with control piseuc input pad, cmos schmitt-trigger, pull-up resister with control apad pad for analog pin oscm pad for x-tal oscillation
S3C3410X risc microprocessor product overview 1- 11 pin descriptions table 1-3. S3C3410X pin descriptions pin i/o description bus controller test[1:0] i the test[1:0] can configure the data bus size for bank 0 in normal or mds mode. the normal mode is for cpu to start its operation by fetching the instruction from external memory. the mds mode is for cpu to be debugged by the external emulator, embeddedice, etc. 00 = normal mode with 8-bit data bus size for bank 0 access. 01 = normal mode with 16-bit data bus size for bank 0 access. 10 = mds mode with 8-bit data bus size for bank 0 access. 11 = mds mode with 16-bit data bus size for bank 0 access. a[23:0] o a[23:0] (address bus) generate the address when external memory access. d[15:0] i/o d[15:0] (data bus) input the data during memory read and output the data during memory write. the data bus width can be programmable for 8-bit or 16-bit by the bankconx register option. ncs[7:0] o ncs[7:0] (chip select) selectively generate the chip select signal of each bank when the external memory access address is within the address range of each bank. the number of access cycle and the bank size can be programmable by the bankconx register option. necs[1:0] o necs[1:0] (external chip select) generate the external chip select signal for the extra device (external i/o device). noe o noe (output enable) indicates that the current bus cycle is a read cycle. nwe o nwe (write enable for x16 sram or sdram) indicates that the current bus cycle is a write cycle. to support the byte write to external memory, the byte to be accessed can be determined by nbe[1:0], which is the selection on upper byte or lower byte. for example, in case of 16-bit sram, nbe[1:0] should play it role as ub(upper byte)/lb(lower byte) to select the upper byte or lower byte. in case of sdram, nwbe[1:0] should play it role as dqm[1:0] to select the upper byte or lower byte. for 16-bit access, not 8-bit access, both nwbe[1:0] should be activated at same time. in certain case, no more byte access is needed. for example, x16 flash memory does not need byte access through 16-bit bus when user need the programming in the flash memory. in this case, please use nwbe[0] instead of nwe to indicate that the current bus cycle is a write cycle. summarizing, nwe should be used to indicate the write bus cycle in case of x16 sram and x16/x8 sdram. in case of x16 with two x8 sram, nwbe[0] and nwbe[1] should be connected to the we of sram, respectively. for more detail information, please refer the chapter 4. nwbe[1:0] o nwbe[1:0] (write byte enable). in case of flash or rom access, nwbe[0] should be connected to the we of memory. for the access to the non-volatile memory, we do not need the selection on bytes because the 8-bit write cycle via 16-bit bus is no more necessary. to program the data into the non-volatile memory, we should always use the 16-bit access. in this configuration, please use nwbe[0] instead of nwe to indicate that the current bus cycle is a write cycle. summarizing, nwbe[0] should be used to indicate the current write bus cycle in case of x8 sram, x8/x16 rom, edodram or flash memory. for more detail information, please refer the chapter 4.
product overview s3 c3410x risc microprocessor 1- 12 table 1-3. S3C3410X signal descriptions (continued) pin i/o description nas o nas generates an address strobe signal for latch device in multiplexed address mode which generate a[23:16] and a[15:8] address in a[15:8] pins. nwait i nwait receives request signal to prolong a current bus cycle. as long as nwait is "low", the current bus cycle cannot be completed. nwrexp o nwrexp outputs write strobe signal for external device, when you write any data into extport register to interface external device. dram/sdram nras[1:0] o row address strobe ncas[1:0] o column address strobe nscs[1:0] o sdram chip select nsras o sdram row address strobe nscas o sdram column address strobe dqm[1:0] o sdram data mask sclk o sdram clock scke o sdram clock enable 16-bit/8-bit timer tclk[4:0] i external clock input for timer tcap[4:0] i capture input for timer tout[4:3] o timer 3, 4 output or pwm output dma ndreq[1:0] i external dma request ndack[1:0] o external dma acknowledge interrupt controller eint[12:0] i external interrupt request uart urxd i uart receives data input utxd o uart transmits data output sio sioclk[1:0] i/o sio external clock siorxd[1:0] i sio receives data input siotxd[1:0] o sio transmits data output siordy i/o sio handshakes signal when sio operation is done by dma iic-bus iicsda i/o iic-bus data iicsck i/o iic-bus clock
S3C3410X risc microprocessor product overview 1- 13 table 1-3. S3C3410X signal descriptions (continued) pin i/o description adc ain[7:0] a adc input avref a adc vref general purpose i/o pn.x i/o general purpose input/output ports rp[7:0] o real time buffer output ports (refer to p7) reset & clock reset i reset is the global reset input for the S3C3410X. for a system reset, reset must be held to "low" level for at least 1us. xtal0 a crystal input for internal oscillation circuit for system clock extal0 a crystal output for internal oscillation circuit for system clock. it's the inverted output of xtal0. xtal1 a 32.768khz crystal input for rtc extal1 a 32.768khz crystal output for rtc. it's the inverted output of xtal1. lcd interface lp o lcd line pulse (inversion of necs0) dclk o lcd clock (inversion of nwrexp) jtag test logic ntrst i ntrst (tap controller reset) can reset the tap controller at power-up. a 100k pull-up resistor is connected to ntrst pin, internally. if the debugger(blackice) is not used, ntrst pin should be "low" level or low active pulse should be applied before cpu running. for example, reset signal can be tied with ntrst. tms i tms (tap controller mode select) can control the sequence of the state diagram of tap controller. a 100k pull-up resistor is connected to tms pin, internally. tck i tck (tap controller clock) can provide the clock input for the jtag logic. a 100k pull-up resistor is connected to tck pin, internally. tdi i tdi (tap controller data input) is the serial input for jtag port. a 100k pull-up resistor is connected to tdi pin, internally. tdo o tdo (tap controller data output) is the serial output for jtag port. power vdd p power supply pin vss p ground pin rtcvdd p rtc power supply adcvdd p adc power supply adcvss p adc ground & rtc ground
product overview s3 c3410x risc microprocessor 1- 14 S3C3410X special function register table 1-4. S3C3410X special function register group register offset r/w description acces s reset value system syscfg0 0x1000 r/w system configuration register w 0xfff1 manager bankcon0 0x2000 r/w memory bank 0 control register w 0x00200070 bankcon1 0x2004 r/w memory bank 1 control register w 0x0 bankcon2 0x2008 r/w memory bank 2 control register w 0x0 bankcon3 0x200c r/w memory bank 3 control register w 0x0 bankcon4 0x2010 r/w memory bank 4 control register w 0x0 bankcon5 0x2014 r/w memory bank 5 control register w 0x0 bankcon6 0x2018 r/w memory bank 6 control register w 0x0 bankcon7 0x201c r/w memory bank 7 control register w 0x0 refcon 0x2020 r/w dram refresh control register w 0x1 extcon0 0x2030 r/w extra device control register 0 w 0x0 extcon1 0x2034 r/w extra device control register 1 w 0x0 extport 0x203e r/w external port data register b/h 0x0 extdat0 0x202c r/w extra chip selection data register 0 b/h 0x0 extdat1 0x202e r/w extra chip selection data register 1 b/h 0x0 dma dmacon0 0x300c r/w dma 0 control register w 0x0 dmasrc0 0x3000 r/w dma 0 source address register w 0x0 dmadst0 0x3004 r/w dma 0 destination address register w 0x0 dmacnt0 0x3008 r/w dma 0 transfer count register w 0x0 dmacon1 0x400c r/w dma 1 control register w 0x0 dmasrc1 0x4000 r/w dma 1 source address register w 0x0 dmadst1 0x4004 r/w dma 1 destination address register w 0x0 dmacnt1 0x4008 r/w dma 1 transfer count register w 0x0 i/o port pdat0 0xb000 r/w port 0 data register b 0x0 pdat1 0xb001 r/w port 1 data register b 0x0 pdat2 0xb002 r/w port 2 data register b 0x0 pdat3 0xb003 r/w port 3 data register b 0x0 pdat4 0xb004 r/w port 4 data register b 0x0 pdat5 0xb005 r/w port 5 data register b 0x0 pdat6 0xb006 r/w port 6 data register b 0x0 pdat7 0xb007 r/w port 7 data register b 0x0 pdat8 0xb008 r port 8 data register b 0x0
S3C3410X risc microprocessor product overview 1- 15 table 1-4. S3C3410X special function register (continued) group register offset r/w description access reset value i/o port pdat9 0xb009 r/w port 9 data register b 0x0 p7br 0xb00b r/w port 7 buffer register b 0x0 pcon0 0xb010 r/w port 0 control register h 0x0 pcon1 0xb012 r/w port 1 control register h 0x0 pcon2 0xb014 r/w port 2 control register h 0x0 pcon3 0xb016 r/w port 3 control register h 0x0 pcon4 0xb018 r/w port 4 control register h 0x0 pcon5 0xb01c r/w port 5 control register w 0x0 pcon6 0xb020 r/w port 6 control register w 0x0 pcon7 0xb024 r/w port 7 control register h 0x0 pcon8 0xb026 r/w port 8 control register b 0x0 pcon9 0xb027 r/w port 9 control register b 0x0 pur0 0xb028 r/w port 0 pull-up control register b 0x80 pdr1 0xb029 r/w port 1 pull-down control register b 0xff pur2 0xb02a r/w port 2 pull-up control register b 0xff pur3 0xb02b r/w port 3 pull-up control register b 0xff pdr4 0xb02c r/w port 4 pull-down control register b 0xff pur5 0xb02d r/w port 5 pull-up control register b 0x0 pur6 0xb02e r/w port 6 pull-up control register b 0x0 pur7 0xb02f r/w port 7 pull-up control register b 0x0 pur8 0xb03c r/w port 8 pull-up control register b 0x0 eintpnd 0xb031 r/w external interrupt pending register b 0x0 eintcon 0xb032 r/w external interrupt control register h 0x0 eintmod 0xb034 r/w external interrupt mode register w 0x0 timer 0 tdat0 0x9000 r/w timer 0 data register h 0xffff tpre0 0x9002 r/w timer 0 prescaler register b 0x0 tcon0 0x9003 r/w timer 0 control register b 0x0 tcnt0 0x9006 r timer 0 counter register h 0x0 timer 1 tdat1 0x9010 r/w timer 1 data register h 0xffff tpre1 0x9012 r/w timer 1 prescaler register b 0x0 tcon1 0x9013 r/w timer 1 control register b 0x0 tcnt1 0x9016 r timer 1 counter register h 0x0
product overview s3 c3410x risc microprocessor 1- 16 table 1-4. S3C3410X special function register (continued) group register offset r/w description access reset value timer 2 tdat2 0x9020 r/w timer 2 data register h 0xffff tpre2 0x9022 r/w timer 2 prescaler register b 0x0 tcon2 0x9023 r/w timer 2 control register b 0x0 tcnt2 0x9026 r timer 2 counter register h 0x0 timer 3 tdat3 0x9031 r/w timer 3 data register b 0xff tpre3 0x9032 r/w timer 3 prescaler register b 0x0 tcon3 0x9033 r/w timer 3 control register b 0x0 tcnt3 0x9037 r timer 3 counter register b 0x0 timer 4 tdat4 0x9041 r/w timer 4 data register b 0xff tpre4 0x9042 r/w timer 4 prescaler register b 0x0 tcon4 0x9043 r/w timer 4 control register b 0x0 tcnt4 0x9047 r timer 4 counter register b 0x0 tfcon 0x904f r/w fifo control register of timer 4 b 0x0 tfstat 0x904e r fifo status register of timer 4 b 0x0 tfb4 0x904b r/w timer 4 fifo register @ byte b 0x0 tfhw4 0x904a r/w timer 4 fifo register @ half-word h 0x0 tfw4 0x9048 r/w timer 4 fifo register @ word w 0x0 uart ulcon 0x5003 r/w uart line control register b 0x0 ucon 0x5007 r/w uart control register b 0x0 ustat 0x500b r uart status register b 0x0 ufcon 0x500f r/w uart fifo control register b 0x0 ufstat 0x5012 r uart fifo status register b 0x0 utxh 0x5017 r/w uart transmit holding register b 0x0 utxh_b 0x5017 r/w uart transmit fifo register @ byte b 0x0 utxh_hw 0x5016 r/w uart transmit fifo register @ half-word h 0x0 utxh_w 0x5014 r/w uart transmit fifo register @ word w 0x0 urxh 0x501b r/w uart receive buffer register b 0x0 urxh_b 0x501b r/w uart receive fifo register @ byte b 0x0 urxh_hw 0x501a r/w uart receive fifo register @ half-word h 0x0 urxh_w 0x5018 r/w uart receive fifo register @ word w 0x0 ubrdiv 0x501e r/w baud rate divisor register for uart h 0x0
S3C3410X risc microprocessor product overview 1- 17 table 1-4. S3C3410X special function register (continued) group register offset r/w description access reset value sio 0 itvcnt0 0x6000 r/w sio 0 interval counter register b 0x0 sbrdr0 0x6001 r/w sio 0 baud rate prescaler register b 0x0 siodat0 0x6002 r/w sio 0 data register b 0x0 siocon0 0x6003 r/w sio 0 control register b 0x0 sio 1 itvcnt1 0x7000 r/w sio 1 interval counter register b 0x0 sbrdr1 0x7001 r/w sio 1 baud rate prescaler register b 0x0 siodat1 0x7002 r/w sio 1 data register b 0x0 siocon1 0x7003 r/w sio 1 control register b 0x0 interrupt intmod 0xc000 r/w interrupt mode register w 0x0 intpnd 0xc004 r/w interrupt pending register w 0x0 intmsk 0xc008 r/w interrupt mask register w 0x0 intpri0 0xc00c r/w interrupt priority register 0 w 0x03020100 intpri1 0xc010 r/w interrupt priority register 1 w 0x07060504 intpri2 0xc014 r/w interrupt priority register 2 w 0x0b0a0908 intpri3 0xc018 r/w interrupt priority register 3 w 0x0f0e0d0c intpri4 0xc01c r/w interrupt priority register 4 w 0x13121110 intpri5 0xc020 r/w interrupt priority register 5 w 0x17161514 intpri6 0xc024 r/w interrupt priority register 6 w 0x1b1a1918 intpri7 0xc028 r/w interrupt priority register 7 w 0x1f1e1d1c adc adccon 0x8002 r/w a/d converter control register h 0x140 adcdat 0x8006 r a/d converter data register h 0x0 basic btcon 0xa002 r/w basic timer control register h 0x0 timer btcnt 0xa007 r basic timer count register b 0x0 iic iiccon 0xe000 r/w iic-bus control register b 0x0 iicstat 0xe001 r/w iic-bus status register b 0x0 iicds 0xe002 r/w iic-bus transmit/receive data shift register b 0x0 iicadd 0xe003 r/w iic-bus transmit/receive address register b 0x0 iicps 0xe004 r/w iic-bus prescaler register b 0x0 iicpcnt 0xe005 r/w iic-bus prescaler counter register b 0x0 syson 0xd003 r/w system control register b 0x0
product overview s3 c3410x risc microprocessor 1- 18 table 1-4. S3C3410X special function register (continued) group register offset r/w description access reset value rtc rtccon 0xa013 r/w rtc control register b 0x0 rtcalm 0xa012 r/w rtc alarm control register b 0x0 almsec 0xa033 r/w alarm second data register b 0x59 almmin 0xa032 r/w alarm minute data register b 0x59 almhour 0xa031 r/w alarm hour data register b 0x23 almday 0xa037 r/w alarm day data register b 0x31 almmon 0xa036 r/w alarm month data register b 0x12 almyear 0xa035 r/w alarm year data register b 0x99 bcdsec 0xa023 r/w bcd second data register b ? bcdmin 0xa022 r/w bcd minute data register b ? bcdhour 0xa021 r/w bcd hour data register b ? bcdday 0xa027 r/w bcd day data register b ? bcddate 0xa020 r/w bcd date data register b ? bcdmon 0xa026 r/w bcd month data register b ? bcdyear 0xa025 r/w bcd year data register b ? rintpnd 0xa010 r/w rtc time interrupt pending register b 0x0 rintcon 0xa011 r/w rtc time interrupt control register b 0x0
S3C3410X risc microprocessor programmer 's model 2- 1 2 programmer's model overview S3C3410X was developed using the advanced arm7tdmi core designed by advanced risc machines, ltd. arm7tdmi supports big-endian and little-endian memory formats, but the S3C3410X supports only the big- endian memory format. processor operating states from the programmer's point of view, the arm7tdmi can be in one of two states: arm state which executes 32-bit, word-aligned arm instructions. thumb state which operates with 16-bit, halfword-aligned thumb instructions. in this state, the pc uses bit 1 to select between alternate halfwords. note transition between these two states does not affect the processor mode or the contents of the registers. switching state entering thumb state entry into thumb state can be achieved by executing a bx instruction with the state bit (bit 0) set in the operand register. transition to thumb state will also occur automatically on return from an exception (irq, fiq, undef, abort, swi etc.), if the exception was entered with the processor in thumb state. entering arm state entry into arm state happens: on execution of the bx instruction with the state bit clear in the operand register. on the processor taking an exception (irq, fiq, reset, undef, abort, swi etc.). in this case, the pc is placed in the exception mode's link register, and execution commences at the exception's vector address. memory formats arm7tdmi views memory as a linear collection of bytes numbered upwards from zero. bytes 0 to 3 hold the first stored word, bytes 4 to 7 the second and so on. arm7tdmi can treat words in memory as being stored either in big-endian or little-endian format.
programmer's model S3C3410X risc micro processor 2- 2 big-endian format in big-endian format, the most significant byte of a word is stored at the lowest numbered byte and the least significant byte at the highest numbered byte. byte 0 of the memory system is therefore connected to data lines 31 through 24. 31 8 4 0 23 9 5 1 10 6 2 11 7 3 8 7 0 4 0 8 higher address lower address word address most significant byte is at lowest address. word is addressed by byte address of most significant byte. 24 15 16 figure 2-1. big-endian addresses of bytes within words little-endian format in little-endian format, the lowest numbered byte in a word is considered the word's least significant byte, and the highest numbered byte the most significant. byte 0 of the memory system is therefore connected to data lines 7 through 0. 31 23 8 7 0 4 0 8 higher address lower address word address least significant byte is at lowest address. word is addressed by byte address of least significant byte. 24 15 16 8 4 0 9 5 1 10 6 2 11 7 3 figure 2-2. little-endian addresses of bytes whthin words instruction length instructions are either 32 bits long (in arm state) or 16 bits long (in thumb state). data types arm7tdmi supports byte (8-bit), halfword (16-bit) and word (32-bit) data types. words must be aligned to four- byte boundaries and half words to two-byte boundaries.
S3C3410X risc microprocessor programmer 's model 2- 3 operating modes arm7tdmi supports seven modes of operation: user (usr): the normal arm program execution state fiq (fiq): designed to support a data transfer or channel process irq (irq): used for general-purpose interrupt handling supervisor (svc): protected mode for the operating system abort mode (abt): entered after a data or instruction prefetch abort system (sys): a privileged user mode for the operating system undefined (und): entered when an undefined instruction is executed mode changes may be made under software control, or may be brought about by external interrupts or exception processing. most application programs will execute in user mode. the non-user modes' known as privileged modes- are entered in order to service interrupts or exceptions, or to access protected resources. registers arm7tdmi has a total of 37 registers - 31 general-purpose 32-bit registers and six status registers - but these cannot all be seen at once. the processor state and operating mode dictate which registers are available to the programmer. the arm state register set in arm state, 16 general registers and one or two status registers are visible at any one time. in privileged (non- user) modes, mode-specific banked registers are switched in. figure 2-3 shows which registers are available in each mode: the banked registers are marked with a shaded triangle. the arm state register set contains 16 directly accessible registers: r0 to r15. all of these except r15 are general-purpose, and may be used to hold either data or address values. in addition to these, there is a seventeenth register used to store status information. register 14 is used as the subroutine link register. this receives a copy of r15 when a branch and link (bl) instruction is executed. at all other times it may be treated as a general-purpose register. the corresponding banked registers r14_svc, r14_irq, r14_fiq, r14_abt and r14_und are similarly used to hold the return values of r15 when interrupts and exceptions arise, or when branch and link instructions are executed within interrupt or exception routines. register 15 holds the program counter (pc). in arm state, bits [1:0] of r15 are zero and bits [31:2] contain the pc. in thumb state, bit [0] is zero and bits [31:1] contain the pc. register 16 is the cpsr (current program status register). this contains condition code flags and the current mode bits. fiq mode has seven banked registers mapped to r8-14 (r8_fiq-r14_fiq). in arm state, many fiq handlers do not need to save any registers. user, irq, supervisor, abort and undefined each have two banked registers mapped to r13 and r14, allowing each of these modes to have a private stack pointer and link registers.
programmer's model S3C3410X risc micro processor 2- 4 r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 r13 r14 r15 (pc) r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 r13_ svc r14_ svc r15 (pc) r0 r1 r2 r3 r4 r5 r6 r7 r9_ fiq r10_ fiq r11_ fiq r12_ fiq r13_ fiq r14_ fiq r15 (pc) r8_ fiq r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 r13_ abt r14_ abt r15 (pc) r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 r13_ irq r14_ irq r15 (pc) r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 r13_ und r14_ und r15 (pc) user/system fiq supervisor irq abort undefined arm state general registers and program counter arm state program status registers cpsr cpsr spsr_ fiq cpsr spsr_ irq = banked register cpsr spsr_ und cpsr spsr_ abt cpsr spsr_ svc figure 2-3. register organization in arm state
S3C3410X risc microprocessor programmer 's model 2- 5 the thumb state register set the thumb state register set is a subset of the arm state set. the programmer has direct access to eight general registers, r0-r7, as well as the program counter (pc), a stack pointer register (sp), a link register (lr), and the cpsr. there are banked stack pointers, link registers and saved process status registers (spsrs) for each privileged mode. this is shown in figure 2-4. r0 r1 r2 r3 r4 r5 r6 r7 lr sp pc user/system fiq supervisor irq abort undefined thumb state general registers and program counter thumb state program status registers cpsr cpsr spsr_ fiq cpsr spsr_ svc cpsr spsr_ abt cpsr spsr_ irq cpsr spsr_ und = banked register lr_ fiq r0 r1 r2 r3 r4 r5 r6 r7 sp_ fiq pc lr_ svc r0 r1 r2 r3 r4 r5 r6 r7 sp_ svc pc lr_ und r0 r1 r2 r3 r4 r5 r6 r7 sp_ und pc lr_ fiq r0 r1 r2 r3 r4 r5 r6 r7 sp_ fiq pc lr_ abt r0 r1 r2 r3 r4 r5 r6 r7 sp_ ab t pc figure 2-4. register organization in thumb state
programmer's model S3C3410X risc micro processor 2- 6 the relationship between arm and thumb state registers the thumb state registers relate to the arm state registers in the following way: thumb state r0-r7 and arm state r0-r7 are identical thumb state cpsr and spsrs and arm state cpsr and spsrs are identical thumb state sp maps onto arm state r13 thumb state lr maps onto arm state r14 the thumb state program counter maps onto the arm state program counter (r15) this relationship is shown in figure 2-5. r0 r1 r2 r3 r4 r5 r6 r7 stack pointer (sp) link register (lr) program counter (pc) cpsr spsr r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 stack pointer (r13) link register (r14) program counter (r15) cpsr spsr lo-registers hi-registers thumb state arm state figure 2-5. mapping of thumb state registers onto arm state registers
S3C3410X risc microprocessor programmer 's model 2- 7 accessing hi-registers in thumb state in thumb state, registers r 8-r15 (the hi registers) are not part of the standard register set. however, the assembly language programmer has limited access to them, and can use them for fast temporary storage. a value may be transferred from a register in the range r0-r7 (a lo register) to a hi register, and from a hi register to a lo register, using special variants of the mov instruction. hi register values can also be compared against or added to lo register values with the cmp and add instructions. for more information, refer to figure 3-34. the program status registers the arm7tdmi contains a current program status register (cpsr), plus five saved program status registers (spsrs) for use by exception handlers. these register's functions are: hold information about the most recently performed alu operation control the enabling and disabling of interrupts set the processor operating mode the arrangement of bits is shown in figure 2-6. ~ ~ 31 condition code flags overflow n z c v i f t m4 m3 m2 m1 m0 30 29 27 28 26 25 24 23 8 7 6 5 4 3 2 1 0 (reserved) control bits carry/borrow/extend zero negative/less than mode bits state bit fiq disable irq disable ~ ~ figure 2-6. program status register format
programmer's model S3C3410X risc micro processor 2- 8 the condition code flags the n, z, c and v bits are the condition code flags. these may be changed as a result of arithmetic and logical operations, and may be tested to determine whether an instruction should be executed. in arm state, all instructions may be executed conditionally: see table 3-2 for details. in thumb state, only the branch instruction is capable of conditional execution: see figure 3-46 for details. the control bits the bottom 8 bits of a psr (incorporating i, f, t and m[4:0]) are known collectively as the control bits. these will be changed when an exception arises. if the processor is operating in a privileged mode, they can also be manipulated by software. the t bit this reflects the operating state. when this bit is set, the processor is executing in thumb state, otherwise it is executing in arm state. this is reflected on the tbit external signal. note that the software must never change the state of the tbit in the cpsr. if this happens, the processor will enter an unpredictable state. interrupt disable bits the i and f bits are the interrupt disable bits. when set, these disable the irq and fiq interrupts respectively. the mode bits the m4, m3, m2, m1 and m0 bits (m[4:0]) are the mode bits. these determine the processor's operating mode, as shown in table 2-1. not all combinations of the mode bits define a valid processor mode. only those explicitly described shall be used. the user should be aware that if any illegal value is programmed into the mode bits, m[4:0], then the processor will enter an unrecoverable state. if this occurs, reset should be applied. reserved bits the remaining bits in the psrs are reserved. when changing a psr's flag or control bits, you must ensure that these unused bits are not altered. also, your program should not rely on them containing specific values, since in future processors they may read as one or zero.
S3C3410X risc microprocessor programmer 's model 2- 9 table 2-1. psr mode bit values m[4:0] mode visible thumb state registers visible arm state registers 10000 user r7..r0, lr, sp pc, cpsr r14..r0, pc, cpsr 10001 fiq r7..r0, lr_fiq, sp_fiq pc, cpsr, spsr_fiq r7..r0, r14_fiq..r8_fiq, pc, cpsr, spsr_fiq 10010 irq r7..r0, lr_irq, sp_irq pc, cpsr, spsr_irq r12..r0, r14_irq, r13_irq, pc, cpsr, spsr_irq 10011 supervisor r7..r0, lr_svc, sp_svc, pc, cpsr, spsr_svc r12..r0, r14_svc, r13_svc, pc, cpsr, spsr_svc 10111 abort r7..r0, lr_abt, sp_abt, pc, cpsr, spsr_abt r12..r0, r14_abt, r13_abt, pc, cpsr, spsr_abt 11011 undefined r7..r0 lr_und, sp_und, pc, cpsr, spsr_und r12..r0, r14_und, r13_und, pc, cpsr 11111 system r7..r0, lr, sp pc, cpsr r14..r0, pc, cpsr reserved bits the remaining bits in the psr's are reserved. when changing a psr's flag or control bits, you must ensure that these unused bits are not altered. also, your program should not rely on them containing specific values, since in future processors they may read as one or zero.
programmer's model S3C3410X risc micro processor 2- 10 exceptions exceptions arise whenever the normal flow of a program has to be halted temporarily, for example to service an interrupt from a peripheral. before an exception can be handled, the current processor state must be preserved so that the original program can resume when the handler routine has finished. it is possible for several exceptions to arise at the same time. if this happens, they are dealt with in a fixed order. see exception priorities on page 2-14. action on entering an exception when handling an exception, the arm7tdmi: 1. preserves the address of the next instruction in the appropriate link register. if the exception has been entered from arm state, then the address of the next instruction is copied into the link register (that is, current pc + 4 or pc + 8 depending on the exception. see table 2-2 on for details). if the exception has been entered from thumb state, then the value written into the link register is the current pc offset by a value such that the program resumes from the correct place on retu rn from the exception. this means that the exception handler need not determine which state the exception was entered from. for example, in the case of swi, movs pc, r14_svc will always return to the next instruction regardless of whether the swi was executed in arm or thumb state. 2. copies the cpsr into the appropriate spsr 3. forces the cpsr mode bits to a value which depends on the exception 4. forces the pc to fetch the next instruction from the relevant exception vector it may also set the interrupt disable flags to prevent otherwise unmanageable nestings of exceptions. if the processor is in thumb state when an exception occurs, it will automatically switch into arm state when the pc is loaded with the exception vector address. action on leaving an exception on completion, the exception handler: 1. moves the link register, minus an offset where appropriate, to the pc. (the offset will vary depending on the type of exception.) 2. copies the spsr back to the cpsr 3. clears the interrupt disable flags, if they were set on entry note an explicit switch back to thumb state is never needed, since restoring the cpsr from the spsr automatically sets the t bit to the value it held immediately prior to the exception.
S3C3410X risc microprocessor programmer 's model 2- 11 exception entry/exit summary table 2-2 summarises the pc value preserved in the relevant r14 on exception entry, and the recommended instruction for exiting the exception handler. table 2-2. exception entry/exit return instruction previous state notes arm r14_x thumb r14_x bl mov pc, r14 pc + 4 pc + 2 1 swi movs pc, r14_svc pc + 4 pc + 2 1 udef movs pc, r14_und pc + 4 pc + 2 1 fiq subs pc, r14_fiq, #4 pc + 4 pc + 4 2 irq subs pc, r14_irq, #4 pc + 4 pc + 4 2 pabt subs pc, r14_abt, #4 pc + 4 pc + 4 1 dabt subs pc, r14_abt, #8 pc + 8 pc + 8 3 reset na ? ? 4 notes: 1. where pc is the address of the bl/swi/undefined instruction fetch which had the prefetch abort. 2. where pc is the address of the instruction which did no t get executed since the fiq or irq took priority. 3. where pc is the address of the load or store instruction which generated the data abort. 4. the value saved in r14_svc upon reset is unpredictable. fiq the fiq (fast interrupt request) exception is designed to support a data transfer or channel process, and in arm state has sufficient private registers to remove the need for register saving (thus minimising the overhead of context switching). fiq is externally generated by taking the nfiq input low. this input can except either synchronous or asynchronous transitions, depending on the state of the isync input signal. when isync is low, nfiq and nirq are considered asynchronous, and a cycle delay for synchronization is incurred before the interrupt can affect the processor flow. irrespective of whether the exception was entered from arm or thumb state, a fiq handler should leave the interrupt by executing subs pc,r14_fiq,#4 fiq may be disabled by setting the cpsr's f flag (but note that this is not possible from user mode). if the f flag is clear, arm7tdmi checks for a low level on the output of the fiq synchroniser at the end of each instruction.
programmer's model S3C3410X risc micro processor 2- 12 irq the irq (interrupt request) exception is a normal interrupt caused by a low level on the nirq input. irq has a lower priority than fiq and is masked out when a fiq sequence is entered. it may be disabled at any time by setting the i bit in the cpsr, though this can only be done from a privileged (non-user) mode. irrespective of whether the exception was entered from arm or thumb state, an irq handler should return from the interrupt by executing subs pc,r14_irq,#4 abort an abort indicates that the current memory access cannot be completed. it can be signalled by the external abort input. arm7tdmi checks for the abort exception during memory access cycles. there are two types of abort: prefetch abort: occurs during an instruction prefetch. data abort: occurs during a data access. if a prefetch abort occurs, the prefetched instruction is marked as invalid, but the exception will not be taken until the instruction reaches the head of the pipeline. if the instruction is not executed - for example because a branch occurs while it is in the pipeline - the abort does not take place. if a data abort occurs, the action taken depends on the instruction type: single data transfer instructions (ldr, str) write back modified base registers: the abort handler must be aware of this. the swap instructio n (swp) is aborted as though it had not been executed. block data transfer instructions (ldm, stm) complete. if write-back is set, the base is updated. if the instruction would have overwritten the base with data (ie it has the base in the transfer list), the overwriting is prevented. all register overwriting is prevented after an abort is indicated, which means in particular that r15 (always the last register to be transferred) is preserved in an aborted ldm instruction. the abort mechanism allows the implementation of a demand paged virtual memory system. in such a system the processor is allowed to generate arbitrary addresses. when the data at an address is unavailable, the memory management unit (mmu) signals an abort. the abort handler must then work out the cause of the abort, make the requested data available, and retry the aborted instruction. the application program needs no knowledge of the amount of memory available to it, nor is its state in any way affected by the abort. after fixing the reason for the abort, the handler should execute the following irrespective of the state (arm or thumb): subs pc,r14_abt,#4 ; for a prefetch abort, or subs pc,r14_abt,#8 ; for a data abort this restores both the pc and the cpsr, and retries the aborted instruction.
S3C3410X risc microprocessor programmer 's model 2- 13 software interrupt the software interrupt instruction (swi) is used for entering supervisor mode, usually to request a particular supervisor function. a swi handler should return by executing the following irrespective of the state (arm or thumb ): mov pc,r14_svc this restores the pc and cpsr, and returns to the instruction following the swi. note nfiq, nirq, isync, lock, bigend, and abort pins exist only in the arm7tdmi cpu core. undefined instruction when arm7tdmi comes across an instruction which it cannot handle, it takes the undefined instruction trap. this mechanism may be used to extend either the thumb or arm instruction set by software emulation. after emulating the failed instruction, the trap handler should execute the following irrespective of the state (arm or thumb): movs pc,r14_und this restores the cpsr and returns to the instruction following the undefined instruction. exception vectors the following table shows the exception vector addresses. table 2-3. exception vectors address exception mode in entry 0x00000000 reset supervisor 0x00000004 undefined instruction undefined 0x00000008 software interrupt supervisor 0x0000000c abort (prefetch) abort 0x00000010 abort (data) abort 0x00000014 reserved reserved 0x00000018 irq irq 0x0000001c fiq fiq
programmer's model S3C3410X risc micro processor 2- 14 exception priorites when multiple exceptions arise at the same time, a fixed priority system determines the order in which they are handled: highest priority: 1. reset 2. data abort 3. fiq 4. irq 5. prefetch abort lowest priority: 6. undefined instruction, software interrupt. not all exceptions can occur at once: undefined instruction and software interrupt are mutually exclusive, since they each correspond to particular (non-overlapping) decodings of the current instruction. if a data abort occurs at the same time as a fiq, and fiqs are enabled (ie the cpsr's f flag is clear), arm7tdmi enters the data abort handler and then immediately proceeds to the fiq vector. a normal return from fiq will cause the data abort handler to resume execution. placing data abort at a higher priority than fiq is necessary to ensure that the transfer error does not escape detection. the time for this exception entry should be added to worst-case fiq latency calculations .
S3C3410X risc microprocessor programmer 's model 2- 15 interrupt latencies the worst case latency for fiq, assuming that it is enabled, consists of the longest time the request can take to pass through the synchroniser ( tsyncmax if asynchronous), plus the time for the longest instruction to complete ( tldm , the longest instruction is an ldm which loads all the registers including the pc), plus the time for the data abort entry ( texc ), plus the time for fiq entry ( tfiq ). at the end of this time arm7tdmi will be executing the instruction at 0x1c. tsyncmax is 3 processor cycles, tldm is 20 cycles, texc is 3 cycles, and tfiq is 2 cycles. the total time is therefore 28 processor cycles. this is just over 1.4 microseconds in a system which uses a continuous 20 mhz processor clock. the maximum irq latency calculation is similar, but must allow for the fact that fiq has higher priority and could delay entry into the irq handling routine for an arbitrary length of time. the minimum latency for fiq or irq consists of the shortest time the request can take through the synchroniser ( tsyncmin ) plus tfiq . this is 4 processor cycles. reset when the reset reset signal goes low, arm7tdmi abandons the executing instruction and then continues to fetch instructions from incrementing word addresses. when reset reset goes high again, arm7tdmi: 1. overwrites r14_svc and spsr_svc by copying the current values of the pc and cpsr into them. the value of the saved pc and spsr is not defined. 2. forces m[4:0] to 10011 (supervisor mode), sets the i and f bits in the cpsr, and clears the cpsr's t bit. 3. forces the pc to fetch the next instruction from address 0x00. 4. execution resumes in arm state.
programmer's model S3C3410X risc micro processor 2- 16 notes
S3C3410X risc microprocessor arm instruction set 3- 1 3 instruction set instruction set summay this chapter describes the arm instruction set and the thumb instruction set in the arm7tdmi core. format summary the arm instruction set formats are shown below. cond rn data/processing/ psr transfer 0 0 i s opcode 0 0 0 p u 0 w l 0 0 0 p u 1 w l 0 1 i p u b w l 0 1 i 1 0 0 p u b w l 1 1 1 1 1 1 1 1 1 0 l 1 1 1 0 p u b w l 1 1 1 1 1 1 0 1 1 1 0 1 l rd rd rn rdhi rdlo rn rn rn rn rd rd rd rn register list rn crn crn crd rd cp opc cp opc operand2 rs rm rm rm rm rn rn rd offset offset crd offset cp# cp# cp# cp cp crm crm ignored by processor 0 1 offset cond cond cond cond cond cond cond cond cond cond cond cond cond cond 0 0 0 0 0 0 a s a s u 1 0 0 0 0 0 0 0 0 0 0 1 b 1 0 0 0 1 0 0 0 1 1 1 1 1 1 0 0 0 0 h h 0 0 0 0 s s 1 1 1 0 1 1 1 0 0 1 0 0 1 0 0 1 0 0 1 multiply multiply long single data swap branch and exchange halfword data transfer: register offset halfword data transfer: immendiate offset single data transfer undefined block data transfer branch coprocessor register transfer coprocessor data operation coprocessor data transfer software interrupt offset 27 26 25 24 23 22 21 20 19 18 17 16 15 13 14 12 11 10 31 30 29 28 9 8 7 6 5 4 3 2 1 0 27 26 25 24 23 22 21 20 19 18 17 16 15 13 14 12 11 10 31 30 29 28 9 8 7 6 5 4 3 2 1 0 figure 3-1. arm instruction set format
arm instruction set S3C3410X risc micr oprocessor 3- 2 note some instruction codes are not defined but do not cause the undefined instruction trap to be taken, for instance a multiply instruction with bit 6 changed to a 1. these instructions should not be used, as their action may change in future arm implementations. instruction summary table 3-1. the arm instruction set mnemonic instruction action adc add with carry rd: = rn + op2 + carry add add rd: = rn + op2 and and rd: = rn and op2 b branch r15: = address bic bit clear rd: = rn and not op2 bl branch with link r14: = r15, r15: = address bx branch and exchange r15: = rn, t bit: = rn[0] cdp coprocessor data processing (coprocessor-specific) cmn compare negative cpsr flags: = rn + op2 cmp compare cpsr flags: = rn ? op2 eor exclusive or rd: = (rn and not op2) or (op2 and not rn) ldc load coprocessor from memory coprocessor load ldm load multiple registers stack manipulation (pop) ldr load register from memory rd: = (address) mcr move cpu register to coprocessor register crn: = rrn {crm} mla multiply accumulate rd: = (rm rs) + rn mov move register or constant rd: = op2
S3C3410X risc microprocessor arm instruction set 3- 3 table 3-1. the arm instruction set (continued) mnemonic instruction action mrc move from coprocessor register to cpu register rn: = crn {crm} mrs move psr status/flags to register rn: = psr msr move register to psr status/flags psr: = rm mul multiply rd: = rm rs mvn move negative register rd: = 0 ffffffff eor op2 orr or rd: = rn or op2 rsb reverse subtract rd: = op2 ? rn rsc reverse subtract with carry rd: = op2 ? rn ? 1 + carry sbc subtract with carry rd: = rn ? op2 ? 1 + carry stc store coprocessor register to memory address: = crn stm store multiple stack manipulation (push) str store register to memory
: = rd sub subtract rd: = rn ? op2 swi software interrupt os call swp swap register with memory rd: = [rn], [rn] := rm teq test bit wise equality cpsr flags: = rn eor op2 tst test bits cpsr flags: = rn and op2
arm instruction set S3C3410X risc micr oprocessor 3- 4 the condition field in arm state, all instructions are conditionally executed according to the state of the cpsr condition codes and the instruction's condition field. this field (bits 31:28) determines the circumstances under which an instruction is to be executed. if the state of the c, n, z and v flags fulfils the conditions encoded by the field, the instruction is executed, otherwise it is ignored. there are sixteen possible conditions, each represented by a two-character suffix that can be appended to the instruction's mnemonic. for example, a branch (b in assembly language) becomes beq for "branch if equal", which means the branch will only be taken if the z flag is set. in practice, fifteen different conditions may be used: these are listed in table 3-2. the sixteenth (1111) is reserved, and must not be used. in the absence of a suffix, the condition field of most instructions is set to "always" (suffix al). this means the instruction will always be executed regardless of the cpsr condition codes. table 3-2. condition code summary code suffix flags meaning 0000 eq z set equal 0001 ne z clear not equal 0010 cs c set unsigned higher or same 0011 cc c clear unsigned lower 0100 mi n set negative 0101 pl n clear positive or zero 0110 vs v set overflow 0111 vc v clear no overflow 1000 hi c set and z clear unsigned higher 1001 ls c clear or z set unsigned lower or same 1010 ge n equals v greater or equal 1011 lt n not equal to v less than 1100 gt z clear and (n equals v) greater than 1101 le z set or (n not equal to v) less than or equal 1110 al (ignored) always
S3C3410X risc microprocessor arm instruction set 3- 5 branch and exchange (bx) this instruction is only executed if the condition is true. the various conditions are defined in table 3-2. this instruction performs a branch by copying the contents of a general register, rn, into the program counter, pc. the branch causes a pipeline flush and refill from the address specified by rn. this instruction also permits the instruction set to be exchanged. when the instruction is executed, the value of rn[0] determines whether the instruction stream will be decoded as arm or thumb instructions. 31 24 27 19 15 8 7 0 0 0 0 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 cond rn 28 16 11 12 23 20 4 3 [3:0] operand register if bit0 of rn = 1, subsequent instructions decoded as thumb instructions if bit0 of rn =0, subsequent instructions decoded as arm instructions [31:28] condition field figure 3-2. branch and exchange instructions instruction cycle times the bx instruction takes 2s + 1n cycles to execute, where s and n are defined as sequential (s-cycle) and non- sequential (n-cycle), respectively. assembler syntax bx - branch and exchange. bx {cond} rn {cond} two character condition mnemonic. see table 3-2. rn is an expression evaluating to a valid register number. using r15 as an operand if r15 is used as an operand, the behavior is undefined.
arm instruction set S3C3410X risc micr oprocessor 3- 6 examples adr r0, into_thumb + 1 ; generate branch target address ; and set bit 0 high - hence ; arrive in thumb state. bx r0 ; branch and change to thumb ; state. code16 ; assemble subsequent code as into_thumb ; thumb instructions adr r5, back_to_arm ; generate branch t arget to word aligned address ; - hence bit 0 is low and so change back to arm state. bx r5 ; branch and change back to arm state. align ; word align code32 ; assemble subsequent code as arm instructions back_to_arm
S3C3410X risc microprocessor arm instruction set 3- 7 branch and branch with link (b, bl) the instruction is only executed if the condition is true. the various conditions are defined table 3-2. the instruction encoding is shown in figure 3-3, below. 31 24 27 cond offset 28 23 [24] link bit 0 = branch 1 = branch with link [31:28] condition field 25 101 l 0 figure 3-3. branch instructions branch instructions contain a signed 2's complement 24 bit offset. this is shifted left two bits, sign extended to 32 bits, and added to the pc. the instruction can therefore specify a branch of +/? 32mbytes. the branch offset must take account of the prefetch operation, which causes the pc to be 2 words (8 bytes) ahead of the current instruction. branches beyond +/? 32mbytes must use an offset or absolute destination which has been previously loaded into a register. in this case the pc should be manually saved in r14 if a branch with link type operation is required. the link bit branch with link (bl) writes the old pc into the link register (r14) of the current bank. the pc value written into r14 is adjusted to allow for the prefetch, and contains the address of the instruction following the branch and link instruction. note that the cpsr is not saved with the pc and r14[1:0] are always cleared. to return from a routine called by branch with link use mov pc,r14 if the link register is still valid or ldm rn!,{..pc} if the link register has been saved onto a stack pointed to by rn. instruction cycle times branch and branch with link instructions take 2s + 1n incremental cycles, where s and n are defined as sequential (s-cycle) and internal (i-cycle).
arm instruction set S3C3410X risc micr oprocessor 3- 8 assembler syntax items in {} are optional. items in <> must be present. b{l}{cond} {l} used to request the branch with link form of the instruction. if absent, r14 will not be affected by the instruction. {cond} a two-character mnemonic as shown in table 3-2. if absent then al (always) will be used. the destination. the assembler calculates the offset. examples here bal here ; assembles to 0xeafffffe (note effect of pc offset). b there ; always condition used as default. cmp r1,#0 ; compare r1 with zero and branch to fred ; if r1 was zero, otherwise continue. beq fred ; continue to next instruction. bl sub+rom ; call subroutine at computed address. adds r1,#1 ; add 1 to register 1, setting cpsr flags ; on the result then call subroutine if blcc sub ; the c flag is clear, which will be the ; case unless r1 held 0xffffffff.
S3C3410X risc microprocessor arm instruction set 3- 9 data processing the data processing instruction is only executed if the condition is true. the conditions are defined in table 3-2. the instruction encoding is shown in figure 3-4. 31 24 27 19 15 cond operand2 28 16 11 12 21 [15:12] destination register 0 = branch 1 = branch with link [19:16] 1st operand register 0 = branch 1 = branch with link [20] set condition codes 0 = do not after condition codes 1 = set condition codes [24:21] operation codes 0000 = and-rd: = op1 and op2 0001 = eor-rd: = op1 eor op2 0010 = sub-rd: = op1-op2 0011 = rsb-rd: = op2-op1 0100 = add-rd: = op1+op2 0101 = adc-rd: = op1+op2+c 0110 = sbc-rd: = op1-op2+c-1 0111 = rsc-rd: = op2-op1+c-1 1000 = tst-set condition codes on op1 and op2 1001 = teo-set condition codes on op1 eor op2 1010 = cmp-set condition codes on op1-op2 1011 = smn-set condition codes on op1+op2 1100 = orr-rd: = op1 or op2 1101 = mov-rd: =op2 1110 = bic-rd: = op1 and not op2 1111 = mvn-rd: = not op2 [25] immediate operand 0 = operand 2 is a register 1 = operand 2 is an immediate value [11:0] operand 2 type selection 26 25 00 l 20 opcode s rn rd 0 rotate shift rm [3:0] 2nd operand register [11:4] shift applied to rm 3 11 0 4 8 11 0 7 imm [7:0] unsigned 8 bit immediate value [11:8] shift applied to imm [31:28] condition field figure 3-4. data processing instructions
arm instruction set S3C3410X risc micr oprocessor 3- 10 the instruction produces a result by performing a specified arithmetic or logical operation on one or two operands. the first operand is always a register (rn). the second operand may be a shifted register (rm) or a rotated 8 bit immediate value (imm) according to the value of the i bit in the instruction. the condition codes in the cpsr may be preserved or updated as a result of this instruction, according to the value of the s bit in the instruction. certain operations (tst, teq, cmp, cmn) do not write the result to rd. they are used only to perform tests and to set the condition codes on the result and always have the s bit set. the instructions and their effects are listed in table 3-3.
S3C3410X risc microprocessor arm instruction set 3- 11 cpsr flags the data processing operations may be classified as logical or arithmetic. the logical operations (and, eor, tst, teq, orr, mov, bic, mvn) perform the logical action on all corresponding bits of the operand or operands to produce the result. if the s bit is set (and rd is not r15, see below) the v flag in the cpsr will be unaffected, the c flag will be set to the carry out from the barrel shifter (or preserved when the shift operation is lsl #0), the z flag will be set if and only if the result is all zeros, and the n flag will be set to the logical value of bit 31 of the result. table 3-3. arm data processing instructions assembler mnemonic op code action and 0000 operand1 and operand2 eor 0001 operand1 eor operand2 wub 0010 operand1 ? operand2 rsb 0011 operand2 operand1 add 0100 operand1 + operand2 adc 0101 operand1 + operand2 + carry sbc 0110 operand1 ? operand2 + carry ? 1 rsc 0111 operand2 ? operand1 + carry ? 1 tst 1000 as and, but result is not written teq 1001 as eor, but result is not written cmp 1010 as sub, but result is not written cmn 1011 as add, but result is not written orr 1100 operand1 or operand2 mov 1101 operand2 (operand1 is ignored) bic 1110 operand1 and not operand2 (bit clear) mvn 1111 not operand2 (operand1 is ignored) the arithmetic operations (sub, rsb, add, adc, sbc, rsc, cmp, cmn) treat each operand as a 32 bit integer (either unsigned or 2's complement signed, the two are equivalent). if the s bit is set (and rd is not r15) the v flag in the cpsr will be set if an overflow occurs into bit 31 of the result; this may be ignored if the operands were considered unsigned, but warns of a possible error if the operands were 2's complement signed. the c flag will be set to the carry out of bit 31 of the alu, the z flag will be set if and only if the result was zero, and the n flag will be set to the value of bit 31 of the result (indicating a negative result if the operands are considered to be 2's complement signed).
arm instruction set S3C3410X risc micr oprocessor 3- 12 shifts when the second operand is specified to be a shifted register, the operation of the barrel shifter is controlled by the shift field in the instruction. this field indicates the type of shift to be performed (logical left or right, arithmetic right or rotate right). the amount by which the register should be shifted may be contained in an immediate field in the instruction, or in the bottom byte of another register (other than r15). the encoding for the different shift types is shown in figure 3-5. 0 [6:5] shift type 00 = logical left 01 = logical right 10 = arithmetic right 11 = rotate right [11:7] shift amount 5 bit unsigned integer [6:5] shift type 00 = logical left 01 = logical right 10 = arithmetic right 11 = rotate right [11:8] shift register shift amount specified in bottom-byte of rs 4 5 6 7 11 1 4 5 6 7 11 8 0 rs figure 3-5. arm shift operations instruction specified shift amount when the shift amount is specified in the instruction, it is contained in a 5 bit field which may take any value from 0 to 31. a logical shift left (lsl) takes the contents of rm and moves each bit by the specified amount to a more significant position. the least significant bits of the result are filled with zeros, and the high bits of rm which do not map into the result are discarded, except that the least significant discarded bit becomes the shifter carry output which may be latched into the c bit of the cpsr when the alu operation is in the logical class (see above). for example, the effect of lsl #5 is shown in figure 3-6. 31 27 26 contents of rm value of operand 2 carry out 0 0 0 0 0 0 figure 3-6. logical shift left note lsl #0 is a special case, where the shifter carry out is the old value of the cpsr c flag. the contents of rm are used directly as the second operand. a logical shift right (lsr) is similar, but the contents of rm are moved to less significant positions in the result. lsr #5 has the effect shown in figure 3-7 .
S3C3410X risc microprocessor arm instruction set 3- 13 31 contents of rm value of operand 2 0 carry out 4 5 0 0 0 0 0 figure 3-7. logical shift right the form of the shift field which might be expected to correspond to lsr #0 is used to encode lsr #32, which has a zero result with bit 31 of rm as the carry output. logical shift right zero is redundant as it is the same as logical shift left zero, so the assembler will convert lsr #0 (and asr #0 and ror #0) into lsl #0, and allow lsr #32 to be specified. an arithmetic shift right (asr) is similar to logical shift right, except that the high bits are filled with bit 31 of rm instead of zeros. this preserves the sign in 2's complement notation. for example, asr #5 is shown in figure 3-8. 31 contents of rm value of operand 2 0 carry out 4 5 30 figure 3-8. arithmetic shift right the form of the shift field which might be expected to give asr #0 is used to encode asr #32. bit 31 of rm is again used as the carry output, and each bit of operand 2 is also equal to bit 31 of rm. the result is therefore all ones or all zeros, according to the value of bit 31 of rm.
arm instruction set S3C3410X risc micr oprocessor 3- 14 rotate right (ror) operations reuse the bits which "overshoot" in a logical shift right operation by reintroducing them at the high end of the result, in place of the zeros used to fill the high end in logical right operations. for example, ror #5 is shown in figure 3-9. 31 contents of rm value of operand 2 0 carry out 4 5 figure 3-9. rotate right the form of the shift field which might be expected to give ror #0 is used to encode a special function of the barrel shifter, rotate right extended ( rrx). this is a rotate right by one bit position of the 33 bit quantity formed by appending the cpsr c flag to the most significant end of the contents of rm as shown in figure 3-10. 31 contents of rm value of operand 2 0 1 carry out c in figure 3-10. rotate right extended
S3C3410X risc microprocessor arm instruction set 3- 15 register specified shift amount only the least significant byte of the contents of rs is used to determine the shift amount. rs can be any general register other than r15. if this byte is zero, the unchanged contents of rm will be used as the second operand, and the old value of the cpsr c flag will be passed on as the shifter carry output. if the byte has a value between 1 and 31, the shifted result will exactly match that of an instruction specified shift with the same value and shift operation. if the value in the byte is 32 or more, the result will be a logical extension of the shift described above: 1. lsl by 32 has result zero, carry out equal to bit 0 of rm. 2. lsl by more than 32 has result zero, carry out zero. 3. lsr by 32 has result zero, carry out equal to bit 31 of rm. 4. lsr by more than 32 has result zero, carry out zero. 5. asr by 32 or more has result filled with and carry out equal to bit 31 of rm. 6. ror by 32 has result equal to rm, carry out equal to bit 31 of rm. 7. ror by n where n is greater than 32 will give the same result and carry out as ror by n-32; therefore repeatedly subtract 32 from n until the amount is in the range 1 to 32 and see above. note the zero in bit 7 of an instruction with a register controlled shift is compulsory; a one in this bit will cause the instruction to be a multiply or undefined instruction.
arm instruction set S3C3410X risc micr oprocessor 3- 16 immediate operand rotates the immediate operand rotate field is a 4 bit unsigned integer which specifies a shift operation on the 8 bit immediate value. this value is zero extended to 32 bits, and then subject to a rotate right by twice the value in the rotate field. this enables many common constants to be generated, for example all powers of 2. writing to r15 when rd is a register other than r15, the condition code flags in the cpsr may be updated from the alu flags as described above. when rd is r15 and the s flag in the instruction is not set the result of the operation is placed in r15 and the cpsr is unaffected. when rd is r15 and the s flag is set the result of the operation is placed in r15 and the spsr corresponding to the current mode is moved to the cpsr. this allows state changes which atomically restore both pc and cpsr. this form of instruction should not be used in user mode. using r15 as an operandy if r15 (the pc) is used as an operand in a data processing instruction the register is used directly. the pc value will be the address of the instruction, plus 8 or 12 bytes due to instruction prefetching. if the shift amount is specified in the instruction, the pc will be 8 bytes ahead. if a register is used to specify the shift amount the pc will be 12 bytes ahead. teq, tst, cmp and cmn opcodes note teq, tst, cmp and cmn do not write the result of their operation but do set flags in the cpsr. an assembler should always set the s flag for these instructions even if this is not specified in the mnemonic. the teqp form of the teq instruction used in earlier arm processors must not be used: the psr transfer operations should be used instead. the action of teqp in the arm7tdmi is to move spsr_ to the cpsr if the processor is in a privileged mode and to do nothing if in user modify instruction cycle times data processing instructions vary in the number of incremental cycles taken as follows: table 3-4. incremental cycle times processing type cycles normal data processing 1s data processing with register specified shift 1s + 1i data processing with pc written 2s + 1n data processing with register specified shift and pc written 2s + 1n +1i note: s, n and i are as defined sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle) respectively.
S3C3410X risc microprocessor arm instruction set 3- 17 assembler syntax mov,mvn (single operand instructions). {cond}{s} rd, cmp,cmn,teq,tst (instructions which do not produce a result). {cond} rn, and,eor,sub,rsb,add,adc,sbc,rsc,orr,bic {cond}{s} rd,rn, where: rm{,} o r,<#expression> {cond} a two-character condition mnemonic. see table 3-2. {s} set condition codes if s present (implied for cmp, cmn, teq, tst). rd, rn and rm expressions evaluating to a register number. <#expression> if this is used, the assembler will attempt to generate a shifted immediate 8-bit field to match the expression. if this is impossible, it will give an error. or #expression, or rrx (rotate right one bit with extend). s asl, lsl, lsr, asr, ror. (asl is a synonym for lsl, they assemble to the same code.) examples addeq r2,r4,r5 ; if the z flag is set make r2:=r4+r5 teqs r4,#3 ; test r4 for equality with 3. ; (the s is in fact redundant as the ; assembler inserts it automatically.) sub r4,r5,r7,lsr r2 ; logical right shift r7 by the number in ; the bottom byte of r2, subtract result ; from r5, and put the answer into r4. mov pc,r14 ; return from subroutine. movs pc,r14 ; return from exception an d restore cpsr ; from spsr_mode.
arm instruction set S3C3410X risc micr oprocessor 3- 18 psr transfer (mrs, msr) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the mrs and msr instructions are formed from a subset of the data processing operations and are implemented using the teq, tst, cmn and cmp instructions without the s flag set. the encoding is shown in figure 3-11. these instructions allow access to the cpsr and spsr registers. the mrs instruction allows the contents of the cpsr or spsr_ to be moved to a general register. the msr instruction allows the contents of a general register to be moved to the cpsr or spsr_ register. the msr instruction also allows an immediate value or register contents to be transferred to the condition code flags (n,z,c and v) of cpsr or spsr_ without affecting the control bits. in this case, the top four bits of the specified register contents or 32 bit immediate value are written to the top four bits of the relevant psr. operand restrictions in user mode, the control bits of the cpsr are protected from change, so only the condition code flags of the cpsr can be changed. in other (privileged) modes the entire cpsr can be changed. note that the software must never change the state of the t bit in the cpsr. if this happens, the processor will enter an unpredictable state. the spsr register which is accessed depends on the mode at the time of execution. for example, only spsr_fiq is accessible when the processor is in fiq mode. you must no t specify r15 as the source or destination register. also, do not attempt to access an spsr in user mode, since no such register exists.
S3C3410X risc microprocessor arm instruction set 3- 19 mrs (transfer register contents or immediate value to psr flag bits only) cond source operand pd 101001111 31 22 27 28 11 12 21 23 i 10 00 26 25 24 0 cond 00000000 00010 pd 101001111 31 22 27 28 11 12 21 23 rm mrs (transfer register contents to psr) 4 3 0 cond 000000000000 00010 rd ps 001111 31 22 27 15 28 16 11 12 21 23 mrs (transfer psr contents to a register) 0 [3:0] source register [22] destination psr 0 = cpsr 1 = spsr_ [31:28] condition field [15:21] destination register [19:16] source psr 0 = cpsr 1 = spsr_ [31:28] condition field [3:0] source register [11:4] source operand is an immediate value [7:0] unsigned 8 bit immediate value [11:8] shift applied to imm [22] destination psr 0 = cpsr 1 = spsr_ [25] immediate operand 0 = source operand is a register 1 = spsr_ [11:0] source operand [31:28] condition field 00000000 rm 11 4 3 0 rotate imm 11 0 8 7 figure 3-11. psr transfer
arm instruction set S3C3410X risc micr oprocessor 3- 20 reserved bits only twelve bits of the psr are defined in arm7tdmi (n,z,c,v,i,f, t & m[4:0]); the remaining bits are reserved for use in future versions of the processor. refer to figure 2-6 for a full description of the psr bits. to ensure the maximum compatibility between arm7tdmi programs and future processors, the following rules should be observed: the reserved bits should be preserved when changing the value in a psr. programs should not rely on specific values from the reserved bits when checking the psr status, since they may read as one or zero in future processors. a read-modify-write strategy should therefore be used when altering the control bits of any psr register; this involves transferring the appropriate psr register to a general register using the mrs instruction, changing only the relevant bits and then transferring the modified value back to the psr register using the msr instruction. examples the following sequence performs a mode change: mrs r0,cpsr ; take a copy of the cpsr. bic r0,r0,#0x1f ; clear the mode bits. orr r0,r0,#new_mode ; select new mode msr cpsr,r0 ; write back the modified cpsr. when the aim is simply to change the condition code flags in a psr, a value can be written directly to the flag bits without disturbing the control bits. the following instruction sets the n,z,c and v flags: msr cpsr_flg,#0xf0000000 ; set all the flags regardless of their previous state ; (does not affect any control bits). no attempt should be made to write an 8 bit immediate value into the whole psr since such an operation cannot preserve the reserved bits. instruction cycle times psr transfers take 1s incremental cycles, where s is defined as sequential (s-cycle).
S3C3410X risc microprocessor arm instruction set 3- 21 assembly syntax mrs - transfer psr contents to a register mrs{cond} rd, msr - transfer register contents to psr msr{cond} ,rm msr - transfer register contents to psr flag bits only msr{cond} ,rm the most significant four bits of the register contents are written to the n,z,c & v flags respectively. msr - transfer immediate value to psr flag bits only msr{cond} ,<#expression> the expression should symbolize a 32 bit value of which the most significant four bits are written to the n,z,c and v flags respectively. key: {cond} two-character con dition mnemonic. see table 3-2. rd and rm express ions evaluating to a register number other than r15 cpsr, cpsr_all, spsr or spsr_all. (cpsr and cpsr_all are synonyms as are spsr and spsr_all) cpsr_flg or spsr_flg <#expression> where this is used, the assembler will attempt to generate a shifted immediate 8-bit field to match the expression. if this is impossible, it will give an error. examples in user mode the instructions behave as follows: msr cpsr_all,rm ; cpsr[31:28] <- rm[31:28] msr cpsr_flg,rm ; cpsr[31:28] <- rm [31:28] msr cpsr_flg,#0xa0000000 ; cpsr[31:28] <- 0xa (set n,c; clear z,v) mrs rd,cpsr ; rd[31:0] <- cpsr[31:0] in privileged modes the instructions behave as follows: msr cpsr_all,rm ; cpsr[31:0] <- rm[31:0] msr cpsr_flg,rm ; cpsr[31:28] <- rm[31:28] msr cpsr_flg,#0x50000000 ; cpsr[31:28] <- 0x5 (set z,v; clear n,c) msr spsr_all,rm ; spsr_[31:0]<- rm[31:0] msr spsr_flg,rm ; spsr_[31:28] <- rm[31:28] msr spsr_flg,#0xc0000000 ; spsr_[31:28] <- 0xc (set n,z; clear c,v) mrs rd,spsr ; rd[31:0] <- spsr_[31:0]
arm instruction set S3C3410X risc micr oprocessor 3- 22 multiply and multiply-accumulate (mul, mla) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-12. the multiply and multiply-accumulate instructions use an 8 bit booth's algorithm to perform integer multiplication. 31 27 19 15 cond 28 16 11 12 21 20 s rd rn [15:12][11:8][3:0] operand registers [19:16] destination register [20] set condition code 0 = do not after condition codes 1 = set condition codes [21] accumulate 0 = multiply only 1 = multiply and accumulate [31:28] condition field 22 1 0 0 1 rs rm a 0 0 0 0 0 0 8 7 4 3 0 figure 3-12. multiply instructions the multiply form of the instruction gives rd:=rm rs. rn is ignored, and should be set to zero for compatibility with possible future upgrades to the instruction set. the multiply-accumulate form gives rd:=rm rs+rn, which can save an explicit add instruction in some circumstances. both forms of the instruction work on operands which may be considered as signed (2's complement) or unsigned integers. the results of a signed multiply and of an unsigned multiply of 32 bit operands differ only in the upper 32 bits - the low 32 bits of the signed and unsigned results are identical. as these instructions only produce the low 32 bits of a multiply, they can be used for both signed and unsigned multiplies. for example consider the multiplication of the operands: operand a operand b result 0xfffffff6 0x0000001 0xffffff38
S3C3410X risc microprocessor arm instruction set 3- 23 if the operands are interpreted as signed operand a has the value ?10, operand b has the value 20, and the result is -200 which is correctly represented as 0xffffff38. if the operands are interpreted as unsigned operand a has the value 4294967286, operand b has the value 20 and the result is 85899345720, which is represented as 0x13ffffff38, so the least significant 32 bits are 0xffffff38. operand restrictions the destination register rd must not be the same as the operand register rm. r15 must not be used as an operand or as the destination register. all other register combinations will give correct results, and rd, rn and rs may use the same register when required.
arm instruction set S3C3410X risc micr oprocessor 3- 24 cpsr flags setting the cpsr flags is optional, and is controlled by the s bit in the instruction. the n (negative) and z (zero) flags are set correctly on the result (n is made equal to bit 31 of the result, and z is set if and only if the result is zero). the c (carry) flag is set to a meaningless value and the v (overflow) flag is unaffected. instruction cycle times mul takes 1s + mi and mla 1s + (m+1)i cycles to execute, where s and i are defined as sequential (s-cycle) and internal (i-cycle), respectively. m the number of 8 bit multiplier array cycles is required to complete the multiply, which is controlled by the value of the multiplier operand specified by rs. its possible values are as follows 1 if bits [32:8] of the multiplier operand are all zero or all one. 2 if bits [32:16] of the multiplier operand are all zero or all one. 3 if bits [32:24] of the multiplier operand are all zero or all one. 4 in all other cases. assembler syntax mul{cond}{s} rd,rm,rs mla{cond}{s} rd,rm,rs,rn {cond} two-character con dition mnemonic. see table 3-2. {s} set condition codes if s present rd, rm, rs and rn exp ressions evaluating to a register number other than r15. examples mul r1,r2,r3 ; r1:=r2 r3 mlaeqs r1,r2,r3,r4 ; conditionally r1:=r2 r3+r4, setting condition codes.
S3C3410X risc microprocessor arm instruction set 3- 25 multiply long and multiply-accumulate long (mull, mlal) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-13. the multiply long instructions perform integer multiplication on two 32 bit operands and produce 64 bit results. signed and unsigned multiplication each with optional accumulate give rise to four variations. 31 27 19 15 cond 28 16 11 12 21 23 u 20 s rdhi rdlo [11:8][3:0] operand registers [19:16][15:12] source destination registers [20] set condition code 0 = do not alter condition codes 1 = set condition codes [21] accumulate 0 = multiply only 1 = multiply and accumulate [22] unsigned 0 = unsigned 1 = signed [31:28] condition field 22 0 0 0 0 1 1 0 0 1 rs rm a 8 7 4 3 0 figure 3-13. multiply long instructions the multiply forms (umull and smull) take two 32 bit numbers and multiply them to produce a 64 bit result of the form rdhi,rdlo := rm rs. the lower 32 bits of the 64 bit result are written to rdlo, the upper 32 bits of the result are written to rdhi. the multiply-accumulate forms (umlal and smlal) take two 32 bit numbers, multiply them and add a 64 bit number to produce a 64 bit result of the form rdhi,rdlo := rm rs + rdhi,rdlo. the lower 32 bits of the 64 bit number to add is read from rdlo. the upper 32 bits of the 64 bit number to add is read from rdhi. the lower 32 bits of the 64 bit result are written to rdlo. the upper 32 bits of the 64 bit result are written to rdhi. the umull and umlal instructions treat all of their operands as unsigned binary numbers and write an unsigned 64 bit result. the smull and smlal instructions treat all of their operands as two's-complement signed numbers and write a two's-complement signed 64 bit result.
arm instruction set S3C3410X risc micr oprocessor 3- 26 operand restrictions r15 must not be used as an operand or as a destination register. rdhi, rdlo, and rm must all specify different registers. cpsr flags setting the cpsr flags is optional, and is controlled by the s bit in the instruction. the n and z flags are set correctly on the result (n is equal to bit 63 of the result, z is set if and only if all 64 bits of the result are zero). both the c and v flags are set to meaningless values. instruction cycle times mull takes 1s + (m+1)i and mlal 1s + (m+2)i cycles to execute, where m is the number of 8 bit multiplier array cycles required to complete the multiply, which is controlled by the value of the multiplier operand specified by rs. its possible values are as follows: for signed instructions smull, smlal: if bits [31:8] of the multiplier operand are all zero or all one. if bits [31:16] of the multiplier operand are all zero or all one. if bits [31:24] of the mul tiplier operand are all zero or all one. in all other cases. for unsigned instructions umull, umlal: if bits [31:8] of the multiplier operand are all zero. if bits [31:16] of the multiplier operand are all zero. if bits [31:24] of the multiplier operand are all zero. in all other cases. s and i are defined as sequential (s-cycle) and internal (i-cycle), respectively.
S3C3410X risc microprocessor arm instruction set 3- 27 assembler syntax table 3-5. assembler syntax descriptions mnemonic description purpose umull{cond}{s} rdlo,rdhi,rm,rs unsigned multiply long 32 x 32 = 64 umlal{cond}{s} rdlo,rdhi,rm,rs unsigned multiply & accumulate long 32 x 32 + 64 = 64 smull{cond}{s} rdlo,rdhi,rm,rs signed multiply long 32 x 32 = 64 smlal{cond}{s} rdlo,rdhi,rm,rs signed multiply & accumulate long 32 x 32 + 64 = 64 where: {cond} two-character condition mnemonic. see table 3-2. {s} set condition codes if s present rdlo, rdhi, rm, rs expressions evaluating to a register number other than r15. examples umull r1,r4,r2,r3 ; r4,r1:=r2 r3 umlals r1,r5,r2,r3 ; r5,r1:=r2 r3+r5,r1 also setting condition codes
arm instruction set S3C3410X risc micr oprocessor 3- 28 single data transfer (ldr, str) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-14. the single data transfer instructions are used to load or store single bytes or words of data. the memory address used in the transfer is calculated by adding an offset to or subtracting an offset from a base register. the result of this calculation may be written back into the base register if auto-indexing is required. 31 27 19 15 0 cond 28 16 11 12 21 23 b 20 l rn rd 22 01 i p u offset w 26 24 25 [15:12] source/destination registers [19:16] base register [20] load/store bit 0 = store to memory 1 = load from memory [21] write-back bit 0 = no write-back 1 = write address into base [22] byte/word bit 0 = transfer word quantity 1 = transfer byte quantity [23] up/down bit 0 = down: subtract offset from base 1 = up: add offset to base [24] pre/post indexing bit 0 = post: add offset after transfer 1 = pre: add offset before transfer [25] immediate offset 0 = offset is an immediate value [11:0] offset shift immediate [11:0] unsigned 12-bit immediate offset 11 11 rm [3:0] offset register [11:4] shift applied to rm [31:28] condition field 0 4 3 0 figure 3-14. single data transfer instructions
S3C3410X risc microprocessor arm instruction set 3- 29 offsets and auto-indexing the offset from the base may be either a 12 bit unsigned binary immediate value in the instruction, or a second register (possibly shifted in some way). the offset may be added to (u=1) or subtracted from (u=0) the base register rn. the offset modification may be performed either before (pre-indexed, p=1) or after (post-indexed, p=0) the base is used as the transfer address. the w bit gives optional auto increment and decrement addressing modes. the modified base value may be written back into the base (w=1), or the old base value may be kept (w=0). in the case of post-indexed addressing, the write back bit is redundant and is always set to zero, since the old base value can be retained by setting the offset to zero. therefore post-indexed data transfers always write back the modified base. the only use of the w bit in a post-indexed data transfer is in privileged mode code, where setting the w bit forces non- privileged mode for the transfer, allowing the operating system to generate a user address in a system where the memory management hardware makes suitable use of this hardware. shifted register offset the 8 shift control bits are described in the data processing instructions section. however, the register specified shift amounts are not available in this instruction class. see figure 3-5. bytes and words this instruction class may be used to transfer a byte (b=1) or a word (b=0) between an arm7tdmi register and memory. the action of ldr(b) and str(b) instructions is influenced by the bigend control signal of arm7tdmi core. the two possible configurations are described below. little-endian configuration a byte load (ldrb) expects the data on data bus inputs 7 through 0 if the supplied address is on a word boundary, on data bus inputs 15 through 8 if it is a word address plus one byte, and so on. the selected byte is placed in the bottom 8 bits of the destination register, and the remaining bits of the register are filled with zeros. please see figure 2-2. a byte store (strb) repeats the bottom 8 bits of the source register four times across data bus outputs 31 through 0. the external memory system should activate the appropriate byte subsystem to store the data. a word load (ldr) will normally use a word aligned address. however, an address offset from a word boundary will cause the data to be rotated into the register so that the addressed byte occupies bits 0 to 7. this means that half-words accessed at offsets 0 and 2 from the word boundary will be correctly loaded into bits 0 through 15 of the register. two shift operations are then required to clear or to sign extend the upper 16 bits. a word store (str) should generate a word aligned address. the word presented to the data bus is not affected if the address is not word aligned. that is, bit 31 of the register being stored always appears on data bus output 31.
arm instruction set S3C3410X risc micr oprocessor 3- 30 ldr from word aligned address a+3 a a+2 a+1 memory 24 16 8 0 a b c d register 24 16 8 0 a b c d ldr from address offset by 2 a+3 a a+2 a+1 memory 24 16 8 0 a b c d register 24 16 8 0 a b c d figure 3-15. little-endian offset addressing big-endian configuration a byte load (ldrb) expects the data on data bus inputs 31 through 24 if the supplied address is on a word boundary, on data bus inputs 23 through 16 if it is a word address plus one byte, and so on. the selected byte is placed in the bottom 8 bits of the destination register and the remaining bits of the register are filled with zeros. please see figure 2-1. a byte store (strb) repeats the bottom 8 bits of the source register four times across data bus outputs 31 through 0. the external memory system should activate the appropriate byte subsystem to store the data. a word load (ldr) should generate a word aligned address. an address offset of 0 or 2 from a word boundary will cause the data to be rotated into the register so that the addressed byte occupies bits 31 through 24. this means that half-words accessed at these offsets will be correctly loaded into bits 16 through 31 of the register. a shift operation is then required to move (and optionally sign extend) the data into the bottom 16 bits. an address offset of 1 or 3 from a word boundary will cause the data to be rotated into the register so that the addressed byte occupies bits 15 through 8. a word store (str) should generate a word aligned address. the word presented to the data bus is not affected if the address is not word aligned. that is, bit 31 of the register being stored always appears on data bus output 31.
S3C3410X risc microprocessor arm instruction set 3- 31 use of r15 write-back must not be specified if r15 is specified as the base register (rn). when using r15 as the base register you must remember it contains an address 8 bytes on from the address of the current instruction. r15 must not be specified as the register offset (rm). when r15 is the source register (rd) of a register store (str) instruction, the stored value will be address of the instruction plus 12. restriction on the use of base register when configured for late aborts, the following example code is difficult to unwind as the base register, rn, gets updated before the abort handler starts. sometimes it may be impossible to calculate the initial value. after an abort, the following example code is difficult to unwind as the base register, rn, gets updated before the abort handler starts. sometimes it may be impossible to calculate the initial value. example: ldr r0,[r1],r1 therefore a post-indexed ldr or str where rm is the same register as rn should not be used. data aborts a transfer to or from a legal address may cause problems for a memory management system. for instance, in a system which uses virtual memory the required data may be absent from main memory. the memory manager can signal a problem by taking the processor abort input high whereupon the data abort trap will be taken. it is up to the system software to resolve the cause of the problem, then the instruction can be restarted and the original program continued. instruction cycle times normal ldr instructions take 1s + 1n + 1i and ldr pc take 2s + 2n +1i incremental cycles, where s,n and i are defined as sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle), respectively. str instructions take 2n incremental cycles to execute.
arm instruction set S3C3410X risc micr oprocessor 3- 32 assembler syntax {cond}{b}{t} rd,
where: ldr load from memory into a register str store from a register into mem ory {cond} two-character condition mnemonic. see table 3-2. {b} if b is present then byte transfer, otherwise word transfer {t} if t is present the w bit will be set in a post-indexed instruction, forcing non-privileged mode for the transfer cycle. t is not allowed when a pre-indexed addressing mode is specified or implied. rd an expression evaluating to a valid register number. rn and rm expressions evaluating to a register number. if rn is r15 then the assembler will subtract 8 from the offset value to allow for arm7tdmi pipelining. in this case base write-back should not be specified.
can be: 1 an expression which generates an address: the assembler will attempt to generate an instruction using the pc as a base and a corrected immediate offset to address the location given by evaluating the expression. this will be a pc relative, pre-indexed address. if the address is out of range, an error will be generated. 2 a pre-indexed addressing specification : [rn] offset of zero [rn,<#expression>]{!} offset of bytes [rn,{+/ ?}rm{,}]{!} offset of +/? contents of index register, shifted by 3 a post-indexed addressing specification: [rn],<#expression> offset of bytes [rn],{+/ ?}rm{,} offset of +/ ? contents of index register, shifted as by . general shift operation (see data processing instructions) but you cannot specify the shift amount by a regi ster. {!} writes back the base register (set the w bit) if! is present.
S3C3410X risc microprocessor arm instruction set 3- 33 examples str r1,[r2,r4]! ; store r1 at r2+r4 (both of which are registers) ; and write back address to r2. str r1,[r2],r4 ; store r1 at r2 and write back r2+r4 to r2. ldr r1,[r2,#16] ; load r1 from contents of r2+16, but don't write back. ldr r1,[r2,r3,lsl#2] ; load r1 from contents of r2+r3 4. ldreqb r1,[r6,#5] ; conditionally load byte at r6+5 into ; r1 bits 0 to 7, filling bits 8 to 31 with zeros. str r1,place ; generate pc relative offset to address place. place
arm instruction set S3C3410X risc micr oprocessor 3- 34 halfwo rd and signed data transfer (ldrh/strh/ldrsb/ldrsh) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-16. these instructions are used to load or store half-words of data and also load sign -extended bytes or half-words of data. the memory address used in the transfer is calculated by adding an offset to or subtracting an offset from a base register. the result of this calculation may be written back into the base register if auto-indexing is required. 31 27 19 15 cond 28 16 11 12 21 23 0 20 l rn rd [3:0] offset register [6][5] s h 0 0 = swp instruction 0 1 = unsigned halfword 1 1 = signed byte 1 1 = signed halfword [15:12] source/destination register [19:16] base register [20] load/store 0 = store to memory 1 = load from memory [21] write-back 0 = no write-back 1 = write address into base [23] up/down 0 = down: subtract offset from base 1 = up: add offset to base [24] pre/post indexing 0 = post: add/subtract offset after transfer 1 = pre: add/subtract offset bofore transfer [31:28] condition field 22 000 p u 0000 w 24 25 1 rm s h 1 8 7 6 5 4 3 0 figure 3-16. halfword and signed data transfer with register offset
S3C3410X risc microprocessor arm instruction set 3- 35 31 27 19 15 cond 28 16 11 12 21 23 1 20 l rn rd [3:0] immediate offset (low nibble) [6][5] s h 0 0 = swp instruction 0 1 = unsigned halfword 1 1 = signed byte 1 1 = signed halfword [11:8] immediate offset (high nibble) [15:12] source/destination register [19:16] base register [20] load/store 0 = store to memory 1 = load from memory [21] write-back 0 = no write-back 1 = write address into base [23] up/down 0 = down: subtract offset from base 1 = up: add offset to base [24] pre/post indexing 0 = post: add/subtract offset after transfer 1 = pre: add/subtract offset bofore transfer [31:28] condition field 22 000 p u offset w 24 25 1 offset s h 1 8 7 6 5 4 3 0 figure 3-17. halfword and signed data transfer with immediate offset and auto-indexing offsets and auto-indexing the offset from the base may be either a 8 -bit unsigned binary immediate value in the instruction, or a second register. the 8-bit offset is formed by concatenating bits 11 to 8 and bits 3 to 0 of the instruction word, such that bit 11 becomes the msb and bit 0 becomes the lsb. the offset may be added to (u=1) or subtracted from (u=0) the base register rn. the offset modification may be performed either before (pre-indexed, p=1) or after (post- indexed, p=0) the base register is used as the transfer address. the w bit gives optional auto-increment and decrement addressing modes. the modified base value may be written back into the base (w=1), or the old base may be kept (w=0). in the case of post-indexed addressing, the write back bit is redundant and is always set to zero, since the old base value can be retained if necessary by setting the offset to zero. therefore post-indexed data transfers always write back the modified base. the write-back bit should not be set high (w=1) when post-indexed addressing is selected.
arm instruction set S3C3410X risc micr oprocessor 3- 36 halfword load and stores setting s=0 and h=1 may be used to transfer unsigned half-words between an arm7tdmi register and memory. the action of ldrh and strh instructions is influenced by the bigend control signal. the two possible configurations are described in the section below. signed byte and halfword loads the s bit controls the loading of sign-extended data. when s=1 the h bit selects between bytes (h=0) and half- words (h=1). the l bit should not be set low (store) when signed (s=1) operations have been selected. the ldrsb instruction loads the selected byte into bits 7 to 0 of the destination register and bits 31 to 8 of the destination register are set to the value of bit 7, the sign bit. the ldrsh instruction loads the selected half-word into bits 15 to 0 of the destination register and bits 31 to 16 of the destination register are set to the value of bit 15, the sign bit. the action of the ldrsb and ldrsh instructions is influenced by the bigend control signal. the two possible configurations are described in the following section. endianness and byte/halfword selection little-endian configuration a signed byte load (ldrsb) expects data on data bus inputs 7 through to 0 if the supplied address is on a word boundary, on data bus inputs 15 through to 8 if it is a word address plus one byte, and so on. the selected byte is placed in the bottom 8 bit of the destination register, and the remaining bits of the register are filled with the sign bit, bit 7 of the byte. please see figure 2-2. a halfword load (ldrsh or ldrh) expects data on data bus inputs 15 through to 0 if the supplied address is on a word boundary and on data bus inputs 31 through to 16 if it is a halfword boundary, (a[1]=1).the supplied address should always be on a halfword boundary. if bit 0 of the supplied address is high then the arm7tdmi will load an unpredictable value. the selected halfword is placed in the bottom 16 bits of the destination register. for unsigned half-words (ldrh), the top 16 bits of the register are filled with zeros and for signed half-words (ldrsh) the top 16 bits are filled with the sign bit, bit 15 of the halfword. a halfword store (strh) repeats the bottom 16 bits of the source register twice across the data bus outputs 31 through to 0. the external memory system should activate the appropriate halfword subsystem to store the data. note that the address must be halfword aligned, if bit 0 of the address is high this will cause unpredictable behavior.
S3C3410X risc microprocessor arm instruction set 3- 37 big-endian configuration a signed byte load (ldrsb) expects data on data bus inputs 31 through to 24 if the supplied address is on a word boundary, on data bus inputs 23 through to 16 if it is a word address plus one byte, and so on. the selected byte is placed in the bottom 8 bit of the destination register, and the remaining bits of the register are filled with the sign bit, bit 7 of the byte. please see figure 2-1. a halfword load (ldrsh or ldrh) expects data on data bus inputs 31 through to 16 if the supplied address is on a word boundary and on data bus inputs 15 through to 0 if it is a halfword boundary, (a[1]=1). the supplied address should always be on a halfword boundary. if bit 0 of the supplied address is high then the arm7tdmi will load an unpredictable value. the selected halfword is placed in the bottom 16 bits of the destination register. for unsigned half-words (ldrh), the top 16 bits of the register are filled with zeros and for signed half-words (ldrsh) the top 16 bits are filled with the sign bit, bit 15 of the halfword. a halfword store (strh) repeats the bottom 16 bits of the source register twice across the data bus outputs 31 through to 0. the external memory system should activate the appropriate halfword subsystem to store the data. note that the address must be halfword aligned, if bit 0 of the address is high this will cause unpredictable behavior. use of r15 write-back should not be specified if r15 is specified as the base register (rn). when using r15 as the base register you must remember it contains an address 8 bytes on from the address of the current instruction. r15 should not be specified as the register offset (rm). when r15 is the source register (rd) of a half-word store (strh) instruction, the stored address will be address of the instruction plus 12. data aborts a transfer to or from a legal address may cause problems for a memory management system. for instance, in a system which uses virtual memory the required data may be absent from the main memory. the memory manager can signal a problem by taking the processor abort input high whereupon the data abort trap will be taken. it is up to the system software to resolve the cause of the problem, then the instruction can be restarted and the original program continued. instruction cycle times normal ldr(h,sh,sb) instructions take 1s + 1n + 1i. ldr(h,sh,sb) pc take 2s + 2n + 1i incremental cycles. s,n and i are defined as sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle), respectively. strh instructions take 2n incremental cycles to execute.
arm instruction set S3C3410X risc micr oprocessor 3- 38 assembler syntax {cond} rd,
ldr load from memory into a register str store from a register into memory {cond} t wo-character condition mnemonic. see table 3-2. h transfer halfword quantity sb load sign extended byte (only valid for ldr) sh load sign extended halfword (only valid for ldr) rd an expression evaluating to a valid register number.
can be: 1 an expression which generates an address: the assembler will attempt to generate an instruction using the pc as a base and a corrected immediate offset to address the location given by evaluating the expression. this will be a pc relative, pre-indexed address. if the address is out of range, an error will be generated. 2 a pre-indexed addressing specification: [rn] offset of zero [rn,<#expression>]{!} offset o f bytes [rn,{+/? }rm]{!} offset of +/ ? contents of index register 3 a post-indexed addressing specification: [rn],<#expression> offset of bytes [rn],{+/ ?}rm offset of +/ ? contents of index register. 4 rn and rm are expressions evaluating to a register number. if rn is r1 5 then the assembler will subtract 8 from the offset value to allow for arm7tdmi pipelining. in this case base write-back should not be specified. {!} writes back the base register (set the w bit) if ! is present.
S3C3410X risc microprocessor arm instruction set 3- 39 examples ldrh r1,[r2, ?r3]! ; load r1 from the contents of the halfword address ; contained in r2 ?r3 (both of which are registers) ; and write back address to r2 strh r3,[r4,#14] ; store the halfword in r3 at r14+14 but don't write back. ldrsb r8,[r2],# ?223 ; load r8 with the sign e xtended contents of the byte ; address contained in r2 and write back r2-223 to r2. ldrnesh r11,[r0] ; conditionally load r11 with the sign extended contents ; of the halfword address contained in r0. here ; generate pc relative offset to address fred. strh r5, [pc,#(fred ?here8)]; store the halfword in r5 at address fred fred
arm instruction set S3C3410X risc micr oprocessor 3- 40 block data transfer (ldm, stm) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-18 . block data transfer instructions are used to load (ldm) or store (stm) any subset of the currently visible registers. they support all possible stacking modes, maintaining full or empty stacks which can grow up or down memory, and are very efficient instructions for saving or restoring context, or for moving large blocks of data around main memory. the register list the instruction can cause the transfer of any registers in the current bank (and non -user mode programs can also transfer to and from the user bank, see below). the register list is a 16 bit field in the instruction, with each bit corresponding to a register. a 1 in bit 0 of the register field will cause r0 to be transferred, a 0 will cause it not to be transferred; similarly bit 1 controls the transfer of r1, and so on. any subset of the registers, or all the registers, may be specified. the only restriction is that the register list should not be empty. whenever r15 is stored to memory the stored value is the address of the stm instruction plus 12. 31 27 19 15 cond 28 16 21 23 s 20 l rn [19:16] base register [20] load/store bit 0 = store to memory 1 = load from memory [21] write-back bit 0 = no write-back 1 = write address into base [22] psr & force user bit 0 = do not load psr or user mode 1 = load psr or force user mode [23] up/down bit 0 = down: subtract offset from base 1 = up: add offset to base [24] pre/post indexing bit 0 = post: add offset after transfer 1 = pre: add offset bofore transfer [31:28] condition field 22 100 p u w 24 25 register list 24 0 figure 3-18. block data transfer instructions
S3C3410X risc microprocessor arm instruction set 3- 41 addressing modes the transfer addresses are determined by the contents of the base register (rn), the pre/post bit (p) and the up/ down bit (u). the registers are transferred in the order lowest to highest, so r15 (if in the list) will always be transferred last. the lowest register also gets transferred to/from the lowest memory address. by way of illustration, consider the transfer of r1, r5 and r7 in the case where rn=0x1000 and write back of the modified base is required (w=1). figure 3.19-22 show the sequence of register transfers, the addresses used, and the value of rn after the instruction has completed. in all cases, had write back of the modified base not been required (w=0), rn would have retained its initial value of 0x1000 unless it was also in the transfer list of a load multiple register instruction, when it would have been overwritten with the loaded value. address alignment the address should normally be a word aligned quantity and non-word aligned addresses do not affect the instruction. however, the bottom 2 bits of the address will appear on a[1:0] and might be interpreted by the memory system. 1 2 3 4 rn r1 r1 r5 r1 r5 r7 rn 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 figure 3-19. post-increment addressing
arm instruction set S3C3410X risc micr oprocessor 3- 42 rn 1 r1 r1 2 r5 3 r1 r5 4 r7 rn 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 figure 3-20. pre-increment addressing rn 1 r1 r1 2 r5 3 r1 r5 4 r7 rn 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 figure 3-21. post-decrement addressing
S3C3410X risc microprocessor arm instruction set 3- 43 rn 1 r1 r1 2 r5 3 r1 r5 4 r7 rn 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 figure 3-22. pre-decrement addressing use of the s bit when the s bit is set in a ldm/stm instruction its meaning depends on whether or not r15 is in the transfer list and on the type of instruction. the s bit should only be set if the instruction is to execute in a privileged mode. ldm with r15 in transfer list and s bit set (mode changes) if the instruction is a ldm then spsr_ is transferred to cpsr at the same time as r15 is loaded. stm with r15 in transfer list and s bit set (user bank transfer) the registers transferred are taken from the user bank rather than the bank corresponding to the current mode. this is useful for saving the user state on process switches. base write-back should not be used when this mechanism is employed. r15 not in list and s bit set (user bank transfer) for both ldm and stm instructions, the user bank registers are transferred rather than the register bank corresponding to the current mode. this is useful for saving the user state on process switches. base write-back should not be used when this mechanism is employed. when the instruction is ldm, care must be taken not to read from a banked register during the following cycle (inserting a dummy instruction such as mov r0, r0 after the ldm will ensure safety). use of r15 as the base r15 should not be used as the base register in any ldm or stm instruction.
arm instruction set S3C3410X risc micr oprocessor 3- 44 inclusion of the base in the register list when write-back is specified, the base is written back at the end of the second cycle of the instruction. during a stm, the first register is written out at the start of the second cycle. a stm which includes storing the base, with the base as the first register to be stored, will therefore store the unchanged value, whereas with the base second or later in the transfer order, will store the modified value. a ldm will always overwrite the updated base if the base is in the list. data aborts some legal addresses may be unacceptable to a memory management system, and the memory manager can indicate a problem with an address by taking the abort signal high. this can happen on any transfer during a multiple register load or store, and must be recoverable if arm7tdmi is to be used in a virtual memory system. abort during stm instructions if the abort occurs during a store multiple instruction, arm7tdmi takes little action until the instruction completes, whereupon it enters the data abort trap. the memory manager is responsible for preventing erroneous writes to the memory. the only change to the internal state of the processor will be the modification of the base register if write-back was specified, and this must be reversed by software (and the cause of the abort resolved) before the instruction may be retried. aborts during ldm instructions when arm7tdmi detects a data abort during a load multiple instruction, it modifies the operation of the instruction to ensure that recovery is possible. overwriting of registers stops when the abort happens. the aborting load will not take place but earlier ones may have overwritten registers. the pc is always the last register to be written and so will always be preserved. the base register is restored, to its modified value if write-back was requested. this ensures recoverability in the case where the base register is also in the transfer list, and may have been overwritten before the abort occurred. the data abort trap is taken when the load multiple has completed, and the system software must undo any base modification (and resolve the cause of the abort) before restarting the instruction. instruction cycle times normal ldm instructions take ns + 1n + 1i and ldm pc takes (n+1)s + 2n + 1i incremental cycles, where s,n and i are defined as sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle), respectively. stm instructions take (n-1)s + 2n incremental cycles to execute, where n is the number of words transferred.
S3C3410X risc microprocessor arm instruction set 3- 45 assembler syntax {cond} rn{!},{^} where: {cond} two character condition mnemonic. see table 3-2. rn an ex pression evaluating to a valid register number a list of registers and register ranges enclosed in {} (e.g. {r0,r2 ?r7,r10}). {!} if present requests write-back (w=1), otherwise w=0. {^} if present set s bit to load the cpsr along with the pc, or force transfer of user bank when in privileged mode. addressing mode names there are different assembler mnemonics for each of the addressing modes, depending on whether the instruction is being used to support stacks or for other purposes. the equivalence between the names and the values of the bits in the instruction are shown in the following table 3-6. table 3-6. addressing mode names name stack other l bit p bit u bit pre-increment load ldmed ldmib 1 1 1 post-increment load ldmfd ldmia 1 0 1 pre-decrement load ldmea ldmdb 1 1 0 post-decrement load ldmfa ldmda 1 0 0 pre-increment store stmfa stmib 0 1 1 post-increment store stmea stmia 0 0 1 pre-decrement store stmfd stmdb 0 1 0 post-decrement store stmed stmda 0 0 0 fd, ed, fa, ea define pre/post indexing and the up/down bit by reference to the form of stack required. the f and e refer to a "full" or "empty" stack, i.e. whether a pre-index has to be done (full) before storing to the stack. the a and d refer to whether the stack is ascending or descending. if ascending, a stm will go up and ldm down, if descending, vice-versa. ia, ib, da, db allow control when ldm/stm are not being used for stacks and simply mean increment after, increment before, decrement after, decrement before.
arm instruction set S3C3410X risc micr oprocessor 3- 46 examples ldmfd sp!,{r0,r1,r2} ; unstack 3 registers. stmia r0,{r0 ?r15} ; save all registers. ldmfd sp!,{r15} ; r15 ? (sp), cpsr unchanged. ldmfd sp!,{r15}^ ; r15 ? (sp), cpsr <- spsr_mode ; (allowed only in privileged modes). stmfd r13,{r0 ?r14}^ ; save user mode regs on stack ; (allowed only in privileged modes). these instructions may be used to save state on subroutine entry, and restore it efficiently on return to the calling routine: stmed sp!,{r0 ?r3,r14} ; save r0 to r3 to use as worksp ace ; and r14 for returning. bl somewhere ; this nested call will overwrite r14 ldmed sp!,{r0 ?r3,r15} ; restore workspace and return.
S3C3410X risc microprocessor arm instruction set 3- 47 single data swap (swp) 31 19 15 cond 28 16 11 12 21 23 b 20 00 rn rd [3:0] source register [15:12] destination register [19:16] base register [22] byte/word bit 0 = swap word quantity 1 = swap word quantity [31:28] condition field 22 00010 0000 rm 1001 27 8 7 4 3 0 figure 3-23. swap instruction the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-23. the data swap instruction is used to swap a byte or word quantity between a register and external memory. this instruction is implemented as a memory read followed by a memory write which are ?locked? together (the processor cannot be interrupted until both operations have completed, and the memory manager is warned to treat them as inseparable). this class of instruction is particularly useful for implementing software semaphores. the swap address is determined by the contents of the base register (rn). the processor first reads the contents of the swap address. then it writes the contents of the source register (rm) to the swap address, and stores the old memory contents in the destination register (rd). the same register may be specified as both the source and destination. the lock output goes high for the duration of the read and write operations to signal to the external memory manager that they are locked together, and should be allowed to complete without interruption. this is important in multi-processor systems where the swap instruction is the only indivisible instruction which may be used to implement semaphores; control of the memory must not be removed from a processor while it is performing a locked operation. bytes and words this instruction class may be used to swap a byte (b=1) or a word (b=0) between an arm7tdmi register and memory. the swp instruction is implemented as a ldr followed by a str and the action of these is as described in the section on single data transfers. in particular, the description of big and little endian configuration applies to the swp instruction.
arm instruction set S3C3410X risc micr oprocessor 3- 48 use of r15 do not use r15 as an operand (rd, rn or rs) in a swp instruction. data aborts if the address used for the swap is unacceptable to a memory management system, the memory manager can flag the problem by driving abort high. this can happen on either the read or the write cycle (or both), and in either case, the data abort trap will be taken. it is up to the system software to resolve the cause of the problem, then the instruction can be restarted and the original program continued. instruction cycle times swap instructions take 1s + 2n +1i incremental cycles to execute, where s,n and i are defined as sequential (s-cycle), non-sequential, and internal (i-cycle), respectively. assembler syntax {cond}{b} rd,rm,[rn] {cond} two-character condition mnemonic. see table 3-2. {b} if b is present then byte transfer, otherwise word transfer rd,rm,rn expressions evaluating to valid register numbers examples swp r0,r1,[r2] ; load r0 with the word addressed by r2, and ; store r1 at r2. swpb r2,r3,[r4] ; load r2 wi th the byte addressed by r4, and ; store bits 0 to 7 of r3 at r4. swpeq r0,r0,[r1] ; conditionally swap the contents of the ; word addressed by r1 with r0.
S3C3410X risc microprocessor arm instruction set 3- 49 software interrupt (swi) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-24, below. 31 24 27 1111 cond comment field (ignored by processor) 28 23 [31:28] condition field 0 figure 3-24. software interrupt instruction the software interrupt instruction is used to enter supervisor mode in a controlled manner. the instruction causes the software interrupt trap to be taken, which effects the mode change. the pc is then forced to a fixed value (0x08) and the cpsr is saved in spsr_svc. if the swi vector address is suitably protected (by external memory management hardware) from modification by the user, a fully protected operating system may be constructed. return from the supervisor the pc is saved in r14_svc upon entering the software interrupt trap, with the pc adjusted to point to the word after the swi instruction. movs pc,r14_svc will return to the calling program and restore the cpsr. note that the link mechanism is not re-entrant, so if the supervisor code wishes to use software interrupts within itself it must first save a copy of the return address and spsr. comment field the bottom 24 bits of the instruction are ignored by the processor, and may be used to communicate information to the supervisor code. for instance, the supervisor may look at this field and use it to index into an array of entry points for routines which perform the various supervisor functions. instruction cycle times software interrupt instructions take 2s + 1n incremental cycles to execute, where s and n are defined as sequential (s-cycle) and non-sequential (n-cycle).
arm instruction set S3C3410X risc micr oprocessor 3- 50 assembler syntax swi{cond} {cond} two character condition mnemonic, table 3-2. evaluated and placed in the comment field (which is ignored by arm7tdmi). examples swi readc ; get ne xt character from read stream. swi writei+"k? ; output a "k" to the write stream. swine 0 ; conditionally call supervisor with 0 in comment field. supervisor code the previous examples assume that suitable supervisor code exists, for instance: 0x08 b supervisor ; swi entry point entrytable ; addresses of supervisor routines dcd zerortn dcd readcrtn dcd writeirtn zero equ 0 readc equ 256 writei equ 512 supervisor ; swi has routine required in bits 8?23 and data (if any) in ; bits 0 ?7. assumes r13_svc points to a suitable stack stmfd r13,{r0 ?r2,r14} ; save work registers and return address. ldr r0,[r14,# ?4] ; get swi instruction. bic r0,r0,#0xff000000 ; clear top 8 bits. mov r1,r0,lsr#8 ; get routine offset. adr r2,entrytable ; get start address of entry table. ldr r15,[r2,r1,lsl#2] ; branch to appropriate routine. writeirtn ; enter with character in r0 bits 0 ?7. ldmfd r13,{r0 ?r2,r15}^ ; restore workspace and return, ; restoring processor mode and flags.
S3C3410X risc microprocessor arm instruction set 3- 51 coprocessor data operations (cdp) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-25. this class of instruction is used to tell a coprocessor to perform some internal operation. no result is communicated back to arm7tdmi, and it will not wait for the operation to complete. the coprocessor could contain a queue of such instructions awaiting execution, and their execution can overlap other activity, allowing the coprocessor and arm7tdmi to perform independent tasks in parallel. coprocessor instructions the ks32c41000, unlike some other arm-based processors, does not have an external coprocessor interface. it does not have a on-chip coprocessor also. so then all coprocessor instructions will cause the undefined instruction trap to be taken on the ks32c41000. these coprocessor instructions can be emulated by the undefined trap handler. even though external coprocessor can not be connected to the ks32c41000, the coprocessor instructions are still described here in full for completeness. (remember that any external coprocessor described in this section is a software emulation.) 31 24 27 19 15 cond crm 28 16 11 12 23 20 [3:0] coprocessor operand register [7:5] coprocessor information [11:8] coprocessor number [15:12] coprocessor destination register [19:16] coprocessor operand register [23:20] coprocessor operation code [31:28] condition field 0 cp cp# crd crn 1110 cp opc 8 7 5 4 3 0 figure 3-25. coprocessor data operation instruction only bit 4 and bits 24 to 31 the coprocessor fields are significant to arm7tdmi. the remaining bits are used by coprocessors. the above field names are used by convention, and particular coprocessors may redefine the use of all fields except cp# as appropriate. the cp# field is used to contain an identifying number (in the range 0 to 15) for each coprocessor, and a coprocessor will ignore any instruction which does not contain its number in the cp# field. the conventional interpretation of the instruction is that the coprocessor should perform an operation specified in the cp opc field (and possibly in the cp field) on the contents of crn and crm, and place the result in crd.
arm instruction set S3C3410X risc micr oprocessor 3- 52 instruction cycle times coprocessor data operations take 1s + bi incremental cycles to execute, where b is the number of cycles spent in the coprocessor busy-wait loop. s and i are defined as sequential (s-cycle) and internal (i-cycle). assembler syntax cdp{cond} p#,,cd,cn,cm{,} {cond} two character condition mnemonic. see table 3-2. p# the unique number of the required coprocessor evaluated to a constant and placed in the cp opc field cd, cn and cm evaluate to the valid coprocessor register numbers crd, crn and crm respectivel y where present is evaluated to a constant and placed in the cp field examples cdp p1,10,c1,c2,c3 ; request coproc 1 to do operation 10 ; on cr2 and cr3, and put the result in cr1. cdpeq p2,5,c1,c2,c3,2 ; if z flag is set request coproc 2 to do operation 5 (type 2) ; on cr2 and cr3, and put the result in cr1.
S3C3410X risc microprocessor arm instruction set 3- 53 coprocessor data transfers (ldc, stc) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-26. this class of instruction is used to load (ldc) or store (stc) a subset of a coprocessor's registers directly to memory. arm7tdmi is responsible for supplying the memory address, and the coprocessor supplies or accepts the data and controls the number of words transferred. [7:0] unsigned 8 bit immediate offset [11:8] coprocessor number [15:12] coprocessor source/destination register [19:16] base register [20] load/store bit 0 = store to memory 1 = load from memory [21] write-back bit 0 = no write-back 1 = write address into base [22] transfer length [23] up/down bit 0 = down: subtract offset from base 1 = up: add offset to base [24] pre/post indexing bit 0 = post: add offset after transfer 1 = pre: add offset before transfer [31:28] condition field 31 27 19 15 cond 28 16 11 12 21 23 n 20 l rn crd 22 110 p u cp# w 24 25 offset 8 7 0 figure 3-26. coprocessor data transfer instructions the coprocessor fields the cp# field is used to identify the coprocessor which is required to supply or accept the data, and a coprocessor will only respond if its number matches the contents of this field. the crd field and the n bit contain information for the coprocessor which may be interpreted in different ways by different coprocessors, but by convention crd is the register to be transferred (or the first register where more than one is to be transferred), and the n bit is used to choose one of two transfer length options. for instance n=0 could select the transfer of a single register, and n=1 could select the transfer of all the registers for context switching.
arm instruction set S3C3410X risc micr oprocessor 3- 54 addressing modes arm7tdmi is responsible for providing the address used by the memory system for the transfer, and the addressing modes available are a subset of those used in single data transfer instructions. note, however, that the immediate offsets are 8 bits wide and specify word offsets for coprocessor data transfers, whereas they are 12 bits wide and specify byte offsets for single data transfers. the 8 bit unsigned immediate offset is shifted left 2 bits and either added to (u=1) or subtracted from (u=0) the base register (rn); this calculation may be performed either before (p=1) or after (p=0) the base is used as the transfer address. the modified base value may be overwritten back into the base register (if w=1), or the old value of the base may be preserved (w=0). note that post-indexed addressing modes require explicit setting of the w bit, unlike ldr and str which always write-back when post-indexed. the value of the base register, modified by the offset in a pre-indexed instruction, is used as the address for the transfer of the first word. the second word (if more than one is transferred) will go to or come from an address one word (4 bytes) higher than the first transfer, and the address will be incremented by one word for each subsequent transfer. address alignment the base address should normally be a word aligned quantity. the bottom 2 bits of the address will appear on a[1:0] and might be interpreted by the memory system. use of r15 if rn is r15, the value used will be the address of the instruction plus 8 bytes. base write-back to r15 must not be specified. data aborts if the address is legal but the memory manager generates an abort, the data trap will be taken. the write-back of the modified base will take place, but all other processor state will be preserved. the coprocessor is partly responsible for ensuring that the data transfer can be restarted after the cause of the abort has been resolved, and must ensure that any subsequent actions it undertakes can be repeated when the instruction is retried. instruction cycle times coprocessor data transfer instructions take (n?1)s + 2n + bi incremental cycles to execute, where: n the number of words transferred. b the number of cycles spent in the coprocessor busy-wait loop. s, n and i are defined as sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle), respectively.
S3C3410X risc microprocessor arm instruction set 3- 55 assembler syntax {cond}{l} p#,cd,
ldc load from memory to coprocessor stc store from coprocessor to memory {l} when present perform long transfer (n=1), otherwise perform short transfer (n=0) {cond} two character con dition mnemonic. see table 3-2. p# the unique number of the required coprocessor cd an expression evaluating to a valid coprocessor register number that is placed in the crd field
can be: 1 an expression which generates an address: the assembler will attempt to gen erate an instruction using the pc as a base and a corrected immediate offset to address the location given by evaluating the expression. this will be a pc relative, pre-indexed address. if the address is out of range, an error will be generated 2 a pre-indexed addressing specification: [rn] offset of zero [rn,<#expression>]{!} offset of bytes 3 a post-indexed addressing specification: [rn],<#expression offset of bytes {!} write back the bas e register (set the w bit) if! is present rn is an expression evaluating to a valid arm7tdmi register number. note if rn is r15, the assembler will subtract 8 from the offset value to allow for arm7tdmi pipelining. examples ldc p1,c2,table ; load c2 of coproc 1 from address ; table, using a pc relative address. stceql p2,c3,[r5,#24]! ; conditionally store c3 of coproc 2 ; into an address 24 bytes up from r5, ; write this address back to r5, and use ; long transfer option (probab ly to store multiple words). note although the address offset is expressed in bytes, the instruction offset field is in words. the assembler will adjust the offset appropriately.
arm instruction set S3C3410X risc micr oprocessor 3- 56 coprocessor register transfers (mrc, mcr) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-27. this class of instruction is used to communicate information directly between arm7tdmi and a coprocessor. an example of a coprocessor to arm7tdmi register transfer (mrc) instruction would be a fix of a floating point value held in a coprocessor, where the floating point number is converted into a 32 bit integer within the coprocessor, and the result is then transferred to arm7tdmi register. a float of a 32 bit value in arm7tdmi register into a floating point value within the coprocessor illustrates the use of arm7tdmi register to coprocessor transfer (mcr). an important use of this instruction is to communicate control information directly from the coprocessor into the arm7tdmi cpsr flags. as an example, the result of a comparison of two floating point values within a coprocessor can be moved to the cpsr to control the subsequent flow of execution. 31 27 19 15 cond 28 16 11 12 21 23 20 l crn rd [3:0] coprocessor operand register [7:5] coprocessor information [11:8] coprocessor number [15:12] arm source/destination register [19:16] coprocessor source/destination register [20] load/store bit 0 = store to coprocessor 1 = load from coprocessor [21] coprocessor operation mode [31:28] condition field 1110 cp opc cp# 24 crm 1 cp 8 7 5 4 3 0 figure 3-27. coprocessor register transfer instructions the coprocessor fields the cp# field is used, as for all coprocessor instructions, to specify which coprocessor is being called upon. the cp opc, crn, cp and crm fields are used only by the coprocessor, and the interpretation presented here is derived from convention only. other interpretations are allowed where the coprocessor functionality is incompatible with this one. the conventional interpretation is that the cp opc and cp fields specify the operation the coprocessor is required to perform, crn is the coprocessor register which is the source or destination of the transferred information, and crm is a second coprocessor register which may be involved in some way which depends on the particular operation specified.
S3C3410X risc microprocessor arm instruction set 3- 57 transfers to r15 when a coprocessor register transfer to arm7tdmi has r15 as the destination, bits 31, 30, 29 and 28 of the transferred word are copied into the n, z, c and v flags respectively. the other bits of the transferred word are ignored, and the pc and other cpsr bits are unaffected by the transfer. transfers from r15 a coprocessor register transfer from arm7tdmi with r15 as the source register will store the pc+12. instruction cycle times mrc instructions take 1s + (b+1)i +1c incremental cycles to execute, where s, i and c are defined as sequential (s-cycle), internal (i-cycle), and coprocessor register transfer (c-cycle), respectively. mcr instructions take 1s + bi +1c incremental cycles to execute, where b is the number of cycles spent in the coprocessor busy-wait loop. assembler syntax {cond} p#,,rd,cn,cm{,} mrc move from coprocessor to arm7tdmi register (l=1) mcr move from arm7tdmi register to coprocessor (l=0) {cond} two character conditio n mnemonic. see table 3-2 p# the unique number of the required coprocessor evaluated to a constant and placed in the cp opc field rd an expression evaluating to a valid arm7tdmi register number cn and cm expressions evaluating to the valid coprocessor register numbers crn and crm respectively where present is evaluated to a constant and placed in the cp field examples mrc p2,5,r3,c5,c6 ; request coproc 2 to perform operation 5 ; on c5 and c6, and transfer th e (single ; 32-bit word) result back to r3. mcr p6,0,r4,c5,c6 ; request coproc 6 to perform operation 0 ; on r4 and place the result in c6. mrceq p3,9,r3,c5,c6,2 ; conditionally request coproc 3 to ; perform operation 9 (type 2) on c5 and ; c6, and transfer the result back to r3.
arm instruction set S3C3410X risc micr oprocessor 3- 58 undefined instruction the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction format is shown in figure 3-28. 31 27 cond 28 25 24 011 xxxxxxxxxxxxxxxxxxxx 1 xxxx 5 4 3 0 figure 3-28. undefined instruction if the condition is true, the undefined instruction trap will be taken. note that the undefined instruction mechanism involves offering this instruction to any coprocessors which may be present, and all coprocessors must refuse to accept it by driving cpa and cpb high. instruction cycle times this instruction takes 2s + 1i + 1n cycles, where s, n and i are defined as sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle). assembler syntax the assembler has no mnemonics for generating this instruction. if it is adopted in the future for some specified use, suitable mnemonics will be added to the assembler. until such time, this instruction must not be used.
S3C3410X risc microprocessor arm instruction set 3- 59 instruction set examples the following examples show ways in which the basic arm7tdmi instructions can combine to give efficient code. none of these methods saves a great deal of execution time (although they may save some), mostly they just save code. using the conditional instructions using conditionals for logical or cmp rn,#p ; if rn=p or rm=q then goto label. beq label cmp rm,#q beq label this can be replaced by cmp rn,#p cmpne rm,#q ; if condition not satisfied try other test. beq label absolute value teq rn,#0 ; test sign rsbmi rn,rn,#0 ; and 2's complement if necessary. multiplication by 4, 5 or 6 (run time) mov rc,ra,lsl#2 ; multiply by 4, cmp rb,#5 ; test value, addcs rc,rc,ra ; complete multiply by 5, addhi rc,rc,ra ; complete multiply by 6. combining discrete and range tests teq rc,# 127 ; discrete test, cmpne rc,# " " ?1 ; range test movls rc,# "" ; if rc<= "" or rc=ascii(127) ; then rc:= "."
arm instruction set S3C3410X risc micr oprocessor 3- 60 division and remainder a number of divide routines for specific applications are provided in source form as part of the ansi c library provided with the arm cross development toolkit, available from your supplier. a short general purpose divide routine follows. ; enter with numbers in ra and rb. mov rcnt,#1 ; bit to control the division. div1 cmp rb,#0x80000000 ; move rb until greater th an ra. cmpcc rb,ra movcc rb,rb,asl#1 movcc rcnt,rcnt,asl#1 bcc div1 mov rc,#0 div2 cmp ra,rb ; test for possible subtraction. subcs ra,ra,rb ; subtract if ok, addcs rc,rc,rcnt ; put relevant bit into result movs rcnt,rcnt,lsr#1 ; shift control bit movne rb,rb,lsr#1 ; halve unless finished. bne div2 ; divide result in rc, remainder in ra. overflow detection in the arm7tdmi 1. overflow in unsigned multiply with a 32-bit result umull rd,rt,rm,rn ; 3 to 6 cycles teq rt,#0 ; +1 cycle and a register bne overflow 2. overflow in signed multiply with a 32-bit result smull rd,rt,rm,rn ; 3 to 6 cycles teq rt,rd asr#31 ; +1 cycle and a register bne overflow 3. overflow in unsigned multiply accumulate with a 32 bit result umlal rd,rt,rm,rn ; 4 to 7 cycles teq rt,#0 ; +1 cycle and a register bne overflow 4. overflow in signed multiply accumulate with a 32 bit result smlal rd,rt,rm,rn ; 4 to 7 cycles teq rt,rd, asr#31 ; +1 cycle and a register bne overflow
S3C3410X risc microprocessor arm instruction set 3- 61 5. overflow in unsigned multiply accumulate with a 64 bit result umull rl,rh,rm,rn ; 3 to 6 cycles adds rl,rl,ra1 ; lower accumulate adc rh,rh,ra2 ; upper accumulate bcs overflow ; 1 cycle and 2 registers 6. overflow in signed multiply accumulate with a 64 bit result smull rl,rh,rm,rn ; 3 to 6 cycles adds rl,rl,ra1 ; lower accumulate adc rh,rh,ra2 ; upper accumulate bvs overflow ; 1 cycle and 2 registers note overflow checking is not applicable to unsigned and signed multiplies with a 64-bit result, since overflow does not occur in such calculations. pseudo-random binary sequence generator it is often necessary to generate (pseudo-) random numbers and the most efficient algorithms are based on shift generators with exclusive-or feedback rather like a cyclic redundancy check generator. unfortunately the sequence of a 32 bit generator needs more than one feedback tap to be maximal length (i.e. 2^32?1 cycles before repetition), so this example uses a 33 bit register with taps at bits 33 and 20. the basic algorithm is newbit:=bit 33 eor bit 20, shift left the 33 bit number and put in newbit at the bottom; this operation is performed for all the newbits needed (i.e. 32 bits). the entire operation can be done in 5 s cycles: ; enter with seed in ra (32 bits), ; rb (1 bit in rb lsb), uses rc. tst rb,rb,lsr#1 ; top bit into carry movs rc,ra,rrx ; 33 bit rotate right adc rb,rb,rb ; carry into lsb of rb eor rc,rc,ra,lsl#12 ; (involved!) eor ra,rc,rc,lsr#20 ; (similarly involved!) new seed in ra, rb as before multiplication by constant using the barrel shifter multiplication by 2^n (1,2,4,8,16,32..) mov ra, rb, lsl #n multiplication by 2^n+1 (3,5,9,17..) add ra,ra,ra,lsl #n multiplication by 2^n?1 (3,7,15..) rsb ra,ra,ra,lsl #n
arm instruction set S3C3410X risc micr oprocessor 3- 62 multiplication by 6 add ra,ra,ra,lsl #1 ; multiply by 3 mov ra,ra,lsl#1 ; and then by 2 multiply by 10 and add in extra number add ra,ra,ra,lsl#2 ; multiply by 5 add ra,rc,ra,lsl#1 ; multiply by 2 and add in next digit general recursive method for rb := ra c, c a constant: 1. if c even, say c = 2^n d, d odd: d=1: mov rb,ra,lsl #n d<>1: {rb := ra d} mov rb,rb,lsl #n 2. if c mod 4 = 1, say c = 2^n d+1, d odd, n>1: d=1: add rb,ra,ra,lsl #n d<>1: {rb := ra d} add rb,ra,rb,lsl #n 3. if c mod 4 = 3, say c = 2^n d?1, d odd, n>1: d=1: rsb rb,ra,ra,lsl #n d<>1: {rb := ra d} rsb rb,ra,rb,lsl #n this is not quite optimal, but close. an example of its non-optimality is multiply by 45 which is done by: rsb rb,ra,ra,lsl#2 ; multiply by 3 rsb rb,ra,rb,lsl#2 ; multiply by 4 3?1 = 11 add rb,ra,rb,lsl# 2 ; multiply by 4 11+1 = 45 rather than by: add rb,ra,ra,lsl#3 ; multiply by 9 add rb,rb,rb,lsl#2 ; multiply by 5 9 = 45
S3C3410X risc microprocessor arm instruction set 3- 63 loading a word from an unknown alignment ; enter with address in ra (32 bits) uses ; rb, rc result in rd. note d must be less than c e.g. 0,1 bic rb,ra,#3 ; get word aligned address ldmia rb,{rd,rc} ; get 64 bits containing answer and rb,ra,#3 ; correction factor in bytes movs rb,rb,lsl#3 ; ...now in bits and test if aligned movne rd,rd,lsr rb ; produce bottom of resu lt word (if not aligned) rsbne rb,rb,#32 ; get other shift amount orrne rd,rd,rc,lsl rb ; combine two halves to get result
arm instruction set S3C3410X risc micr oprocessor 3- 64 thumb instruction set format the thumb instruction sets are 16-bit versions of arm instruction sets (32-bit format). the arm instructions are reduced to 16-bit versions, thumb instructions, at the cost of versatile functions of the arm instruction sets. the thumb instructions are decompressed to the arm instructions by the thumb decomposer inside the arm7tdmi core. as the thumb instructions are compressed arm instructions, the thumb instructions have the 16-bit format instructions and have some restrictions. the restrictions by 16-bit format is fully notified for using the thumb instructions. format summary the thumb instruction set formats are shown in the following figure. move shifted register 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 0 l 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 0 0 l 1 0 r 1 1 0 1 0 sp 1 l l s h 0 0 1 b l 0 1 h 0 1 b 0 0 1 1 1 i op op op op op l 0 s 1 offset5 rs rd rn/offset3 rd rs rd offset8 rs rd/hd rd h1 h2 rs/hs rd word8 rd rb ro ro rb rd offset5 rb rd rb rd offset5 rd rd word8 word8 sword7 rb cond rlist rlist softset8 value8 offset11 offset add/subtract move/compare/add/ subtract immediate alu operations hi register operations /branch exchange pc-relative load load/store with register offset load/store with immediate offset load/store sign-extended byte/halfword load/store halfword sp-relative load/store load address add offset to stack pointer push/pop register multiple load/store conditional branch software interrupt unconditional branch long branch with link 15 14 13 12 11 10 9 8 7 6 5 4 2 3 1 0 15 14 13 12 11 10 9 8 7 6 5 4 2 3 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 figure 3-29. thumb instruction set formats
S3C3410X risc microprocessor arm instruction set 3- 65 opcode summary the following table summarizes the thumb instruction set. for further information about a particular instruction please refer to the sections listed in the right-most column. table 3-7. thumb instruction set opcodes mnemonic instruction lo-register operand hi-register operand condition codes set adc add with carry y ? y add add y y y (1) and and y ? y asr arithmetic shift right y ? y b unconditional branch y ? ? bxx conditional branch y ? ? bic bit clear y ? y bl branch and link ? ? ? bx branch and exchange y y ? cmn compare negative y ? y cmp compare y y y eor eor y ? y ldmia load multiple y ? ? ldr load word y ? ? ldrb load byte y ? ? ldrh load halfword y ? ? lsl logical shift left y ? y ldsb load sign-extended byte y ? ? ldsh load sign-extended halfword y ? ? lsr logical shift right y ? y mov move register y y y (2) mul multiply y ? y mvn move negative register y ? y
arm instruction set S3C3410X risc micr oprocessor 3- 66 table 3-7. thumb instruction set opcodes (continued) mnemonic instruction lo-register operand hi-register operand condition codes set neg negate y ? y orr or y ? y pop pop register y ? ? push push register y ? ? ror rotate right y ? y sbc subtract with carry y ? y stmia store multiple y ? ? str store word y ? ? strb store byte y ? ? strh store halfword y ? ? swi software interrupt ? ? ? sub subtract y ? y tst test bits y ? y notes: 1. the condition codes are unaffected by the format 5, 12, and 13 versions of this instruction. 2. the condition codes are unaffected by the format 5 version of this instruction.
S3C3410X risc microprocessor arm instruction set 3- 67 format 1: move shifted register 15 0 0 14 10 [2:0] destination register [5:3] source register [10:6] immediate vale [12:11] opcode 0 = lsl 1 = lsr 2 = asr offset5 6 5 3 2 rd 0 0 13 12 11 op rs figure 3-30. format 1 operation these instructions move a shifted value between lo registers. the thumb assembler syntax is shown in table 3-8. note all instructions in this group set the cpsr condition codes. table 3-8. summary of format 1 instructions op thumb assembler arm equipment action 00 lsl rd, rs, #offset5 movs rd, rs, lsl #offset5 shift rs left by a 5-bit immediate value and store the result in rd. 01 lsr rd, rs, #offset5 movs rd, rs, lsr #offset5 perform logical shift right on rs by a 5-bit immediate value and store the result in rd. 10 asr rd, rs, #offset5 movs rd, rs, asr #offset5 perform arithmetic shift right on rs by a 5-bit immediate value and store the result in rd. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-8. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples lsr r2, r5, #27 ; logical shift right the contents ; of r5 by 27 and store the result in r2 . ; set condition codes on the result.
arm instruction set S3C3410X risc micr oprocessor 3- 68 format 2: add/subtract 15 0 14 10 [2:0] destination register [5:3] source register [8:6] register/immediate vale [9] opcode 0 = add 1 = sub [10] immediate flag 0 = register operand 1 = immediate oerand rn/offset3 rd 0 0 13 12 11 op rs 9 8 1 1 1 6 5 3 2 0 figure 3-31. format 2 operation these instructions allow the contents of a lo register or a 3-bit immediate value to be added to or subtracted from a lo register. the thumb assembler syntax is shown in table 3-9. note all instructions in this group set the cpsr condition codes. table 3-9. summary of format 2 instructions op i thumb assembler arm equipment action 0 0 add rd, rs, rn adds rd, rs, rn add contents of rn to contents of rs. place result in rd. 0 1 add rd, rs, #offset3 adds rd, rs, #offset3 add 3-bit immediate value to contents of rs. place result in rd. 1 0 sub rd, rs, rn subs rd, rs, rn subtract contents of rn from contents of rs. place result in rd. 1 1 sub rd, rs, #offset3 subs rd, rs, #offset3 subtract 3-bit immediate value from contents of rs. place result in rd. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-9. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples add r0, r3, r4 ; r0 := r3 + r4 and set condition codes on the result. sub r6, r2, #6 ; r6 := r2 ? 6 and set condition codes.
S3C3410X risc microprocessor arm instruction set 3- 69 format 3: move/compare/add/subtract immediate 15 0 0 14 10 [7:0] immediate vale [10:8] source/destination register [12:11] opcode 0 = mov 1 = cmp 2 = add 3 = sub offset8 rd 0 0 13 12 11 op 7 8 figure 3-32. format 3 operations the instructions in this group perform operations between a lo register and an 8-bit immediate value. the thumb assembler syntax is shown in table 3-10. note all instructions in this group set the cpsr condition codes. table 3-10. summary of format 3 instructions op thumb assembler arm equipment action 00 mov rd, #offset8 movs rd, #offset8 move 8-bit immediate value into rd. 01 cmp rd, #offset8 cmp rd, #offset8 compare contents of rd with 8-bit immediate value. 10 add rd, #offset8 adds rd, rd, #offset8 add 8-bit immediate value to contents of rd and place the result in rd. 11 sub rd, #offset8 subs rd, rd, #offset8 subtract 8-bit immediate value from contents of rd and place the result in rd. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-10. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples mov r0, #128 ; r0 := 128 and set condition codes cmp r2, #62 ; set condition codes on r2 ? 62 add r1, #255 ; r1 := r1 + 255 and set condition codes sub r6, #145 ; r6 := r6 ? 145 and set condition codes
arm instruction set S3C3410X risc micr oprocessor 3- 70 format 4: alu operations 15 0 0 14 10 [2:0] source/destination register [5:3] source register 2 [9:6] opcode 5 6 3 rd 0 0 13 12 11 op rs 0 0 0 9 2 figure 3-33. format 4 operation the following instructions perform alu operations on a lo register pair. note all instructions in this group set the cpsr condition codes. table 3-11. summary of format 4 instructions op thumb assembler arm equipment action 0000 and rd, rs ands rd, rd, rs rd:= rd and rs 0001 eor rd, rs eors rd, rd, rs rd:= rd eor rs 0010 lsl rd, rs movs rd, rd, lsl rs rd := rd << rs 0011 lsr rd, rs movs rd, rd, lsr rs rd := rd >> rs 0100 asr rd, rs movs rd, rd, asr rs rd := rd asr rs 0101 adc rd, rs adcs rd, rd, rs rd := rd + rs + c-bit 0110 sbc rd, rs sbcs rd, rd, rs rd := rd ? rs ? not c-bit 0111 ror rd, rs movs rd, rd, ror rs rd := rd ror rs 1000 tst rd, rs tst rd, rs set condition codes on rd and rs 1001 neg rd, rs rsbs rd, rs, #0 rd = ? rs 1010 cmp rd, rs cmp rd, rs set condition codes on rd ? rs 1011 cmn rd, rs cmn rd, rs set condition codes on rd + rs 1100 orr rd, rs orrs rd, rd, rs rd := rd or rs 1101 mul rd, rs muls rd, rs, rd rd := rs rd 1110 bic rd, rs bics rd, rd, rs rd := rd and not rs 1111 mvn rd, rs mvns rd, rs rd := not rs
S3C3410X risc microprocessor arm instruction set 3- 71 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-11. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples eor r3, r4 ; r3 := r3 eor r4 and set condition codes ror r1, r0 ; rotate right r1 by the value in r0, store ; the result in r1 and set condition codes neg r5, r3 ; subtract the contents of r3 from zero, ; store the result in r5. set condition codes ie r5 = ? r3 cmp r2, r6 ; set the condition codes on the result of r2 ? r6 mul r0, r7 ; r0 := r7 r0 and set condition codes
arm instruction set S3C3410X risc micr oprocessor 3- 72 format 5: hi-register operations/branch exchange 15 0 0 14 10 [2:0] destination register [5:3] source register [6] hi operand flag 2 [7] hi operand flag 1 [9:8] opcode 6 5 3 2 rd/hd 0 0 13 12 11 op rs/hs 0 0 0 9 8 7 h1 h2 figure 3-34. format 5 operation there are four sets of instructions in this group. the first three allow add, cmp and mov operations to be performed between lo and hi registers, or a pair of hi registers. the fourth, bx, allows a branch to be performed which may also be used to switch processor state. the thumb assembler syntax is shown in table 3-12. note in this group only cmp (op = 01) sets the cpsr condition codes. the action of h1= 0, h2 = 0 for op = 00 (add), op =01 (cmp) and op = 10 (mov) is undefined, and should not be used. table 3-12. summary of format 5 instructions op h1 h2 thumb assembler arm equivalent action 00 0 1 add rd, hs add rd, rd, hs add a register in the range 8?15 to a register in the range 0?7. 00 1 0 add hd, rs add hd, hd, rs add a register in the range 0?7 to a register in the range 8?15. 00 1 1 add hd, hs add hd, hd, hs add two registers in the range 8?15 01 0 1 cmp rd, hs cmp rd, hs compare a register in the range 0?7 with a register in the range 8?15. set the condition code flags on the result. 01 1 0 cmp hd, rs cmp hd, rs compare a register in the range 8?15 with a register in the range 0?7. set the condition code flags on the result.
S3C3410X risc microprocessor arm instruction set 3- 73 table 3-12. summary of format 5 instructions (continued) op h1 h2 thumb assembler arm equivalent action 01 1 1 cmp hd, hs cmp hd, hs compare two registers in the range 8?15. set the condition code flags on the result. 10 0 1 mov rd, hs mov rd, hs move a value from a register in the range 8?15 to a register in the range 0?7. 10 1 0 mov hd, rs mov hd, rs move a value from a register in the range 0?7 to a register in the range 8?15. 10 1 1 mov hd, hs mov hd, hs move a value between two registers in the range 8?15. 11 0 0 bx rs bx rs perform branch (plus optional state change) to address in a register in the range 0?7. 11 0 1 bx hs bx hs perform branch (plus optional state change) to address in a register in the range 8?15. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-12. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. the bx instruction bx performs a branch to a routine whose start address is specified in a lo or hi register. bit 0 of the address determines the processor state on entry to the routine: bit 0 = 0 causes the processor to enter arm state. bit 0 = 1 causes the processor to enter thumb state. note the action of h1 = 1 for this instruction is undefined, and should not be used.
arm instruction set S3C3410X risc micr oprocessor 3- 74 examples hi-register operations add pc, r5 ; pc := pc + r5 but don't set the condition codes. cmp r4, r12 ; set the condition codes on the result of r4 ? r12. mov r15, r14 ; move r14 (lr) into r15 (pc) ; but don't set the condition codes, ; eg. return from subroutine. branch and exchange ; switch from thumb to arm state. adr r1,outofthumb ; load address of outofthumb into r1. mov r11,r1 bx r11 ; transfer the contents of r11 into the pc. ; bit 0 of r11 determines whether ; arm or thumb state is entered, ie. arm state here. align code32 outofthumb ; now processing arm instructions... using r15 as an operand if r15 is used as an operand, the value will be the address of the instruction + 4 with bit 0 cleared. executing a bx pc in thumb state from a non-word aligned address will result in unpredictable execution.
S3C3410X risc microprocessor arm instruction set 3- 75 format 6: pc-relative load 15 0 0 14 10 [7:0] immediate value [10:8] destination register word 8 0 0 13 12 11 rd 0 0 8 7 figure 3-35. format 6 operation this instruction loads a word from an address specified as a 10-bit immediate offset from the pc. the thumb assembler syntax is shown below. table 3-13. summary of pc-relative load instruction thumb assembler arm equivalent action ldr rd, [pc, #imm] ldr rd, [r15, #imm] add unsigned offset (255 words, 1020 bytes) in imm to the current value of the pc. load the word from the resulting address into rd. note : the value specified by #imm is a full 10-bit address, but must always be word-aligned (ie with bits 1:0 set to 0), since the assembler places #imm >> 2 in field word 8. the value of the pc will be 4 bytes greater than the address of this instruction, but bit 1 of the pc is forced to 0 to ensure it is word aligned. instruction cycle times all instructions in this format have an equivalent arm instruction. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples ldr r3,[pc,#844] ; load into r3 the word found at the ; address formed by adding 844 to pc. ; bit[1] of pc is forced to zero. ; note that the thumb opcode will contain ; 211 as the word8 value.
arm instruction set S3C3410X risc micr oprocessor 3- 76 format 7: load/store with register offset [2:0] source/destination register [5:3] base register [8:6] offset register [10] byte/word flag 0 = transfer word quantity 1 = transfer byte quantity [11] load/store flag 0 = store to memory 1 = load from memory 15 0 0 14 10 6 5 3 2 rd 1 0 13 12 11 rb 1 l b 9 8 ro 0 figure 3-36. format 7
S3C3410X risc microprocessor arm instruction set 3- 77 operation these instructions transfer byte or word values between registers and memory. memory addresses are pre- indexed using an offset register in the range 0?7. the thumb assembler syntax is shown in table 3-14. table 3-14. summary of format 7 instructions l b thumb assembler arm equivalent action 0 0 str rd, [rb, ro] str rd, [rb, ro] pre-indexed word store: calculate the target address by adding together the value in rb and the value in ro. store the contents of rd at the address. 0 1 strb rd, [rb, ro] strb rd, [rb, ro] pre-indexed byte store: calculate the target address by adding together the value in rb and the value in ro. store the byte value in rd at the resulting address. 1 0 ldr rd, [rb, ro] ldr rd, [rb, ro] pre-indexed word load: calculate the source address by adding together the value in rb and the value in ro. load the contents of the address into rd. 1 1 ldrb rd, [rb, ro] ldrb rd, [rb, ro] pre-indexed byte load: calculate the source address by adding together the value in rb and the value in ro. load the byte value at the resulting address. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-14. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples str r3, [r2,r6] ; store word in r3 at the address ; formed by adding r6 to r2. ldrb r2, [r0,r7] ; load into r2 the byte found at ; the address formed by adding r7 to r0.
arm instruction set S3C3410X risc micr oprocessor 3- 78 format 8: load/store sign-extended byte/halfword [2:0] destination register [5:3] base register [8:6] offset register [10] sign-extended flag 0 = operand not sing-extended 1 = operand sing-extended [11] h flag 15 0 0 14 10 6 5 3 2 rd 1 0 13 12 11 rb 1 h s 9 8 ro 1 figure 3-37. format 8 operation these instructions load optionally sign-extended bytes or halfwords, and store halfwords. the thumb assembler syntax is shown below. table 3-15. summary of format 8 instructions l b thumb assembler arm equivalent action 0 0 strh rd, [rb, ro] strh rd, [rb, ro] store halfword: add ro to base address in rb. store bits 0?15 of rd at the resulting address. 0 1 ldrh rd, [rb, ro] ldrh rd, [rb, ro] load halfword: add ro to base address in rb. load bits 0?15 of rd from the resulting address, and set bits 16?31 of rd to 0. 1 0 ldsb rd, [rb, ro] ldrsb rd, [rb, ro] load sign-extended byte: add ro to base address in rb. load bits 0?7 of rd from the resulting address, and set bits 8?31 of rd to bit 7. 1 1 ldsh rd, [rb, ro] ldrsh rd, [rb, ro] load sign-extended halfword: add ro to base address in rb. load bits 0?15 of rd from the resulting address, and set bits 16?31 of rd to bit 15.
S3C3410X risc microprocessor arm instruction set 3- 79 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-15. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples strh r4, [r3, r0] ; store the lower 16 bits of r4 at the ; address formed by ad ding r0 to r3. ldsb r2, [r7, r1] ; load into r2 the sign extended byte ; found at the address formed by adding r1 to r7. ldsh r3, [r4, r2] ; load into r3 the sign extended halfword ; found at the address formed by adding r2 to r4.
arm instruction set S3C3410X risc micr oprocessor 3- 80 format 9: load/store with immediate offset [2:0] source/destination register [5:3] base register [10:6] offset register [11] load/store flag 0 = store to memory 1 = load from memory [12] byte/word flad 0 = transfer word quantity 1 = transfer byte quantity 15 0 0 14 10 6 5 3 2 rd 1 1 13 12 11 rb b l offset5 figure 3-38. format 9
S3C3410X risc microprocessor arm instruction set 3- 81 operation these instructions transfer byte or word values between registers and memory using an immediate 5 or 7-bit offset. the thumb assembler syntax is shown in table 3-16. table 3-16. summary of format 9 instructions l b thumb assembler arm equivalent action 0 0 str rd, [rb, #imm] str rd, [rb, #imm] calculate the target address by adding together the value in rb and imm. store the contents of rd at the address. 1 0 ldr rd, [rb, #imm] ldr rd, [rb, #imm] calculate the source address by adding together the value in rb and imm. load rd from the address. 0 1 strb rd, [rb, #imm] strb rd, [rb, #imm] calculate the target address by adding together the value in rb and imm. store the byte value in rd at the address. 1 1 ldrb rd, [rb, #imm] ldrb rd, [rb, #imm] calculate source address by adding together the value in rb and imm. load the byte value at the address into rd. note : for word accesses (b = 0), the value specified by #imm is a full 7-bit address, but must be word-aligned (ie with bits 1:0 set to 0), since the assembler places #imm >> 2 in the offset5 field. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-16. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples ldr r2, [r5,#116] ; load into r2 the word found at the ; address formed by adding 116 to r5. ; note that the thumb opcode will ; contain 29 as the offset5 value. strb r1, [r0,#13 ] ; store the lower 8 bits of r1 at the ; address formed by adding 13 to r0. ; note that the thumb opcode will ; contain 13 as the offset5 value.
arm instruction set S3C3410X risc micr oprocessor 3- 82 format 10: load/store halfword [2:0] source/destination register [5:3] base register [10:6] immediate value [11] load/store flag 0 = store to memory 1 = load from memory 15 0 0 14 10 6 5 3 2 rd 1 0 13 12 11 rb 0 l offset5 figure 3-39. format 10 operation these instructions transfer halfword values between a lo register and memory. addresses are pre-indexed, using a 6-bit immediate value. the thumb assembler syntax is shown in table 3-17. table 3-17. halfword data transfer instructions l thumb assembler arm equivalent action 0 strh rd, [rb, #imm] strh rd, [rb, #imm] add #imm to base address in rb and store bits 0?15 of rd at the resulting address. 1 ldrh rd, [rb, #imm] ldrh rd, [rb, #imm] add #imm to base address in rb. load bits 0?15 from the resulting address into rd and set bits 16?31 to zero. note : #imm is a full 6-bit address but must be halfword-aligned (ie with bit 0 set to 0) since the assembler pla ces #imm >> 1 in the offset5 field. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-17. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples strh r6, [r1, #56] ; store the lower 16 bits of r4 at the address formed by ; adding 56 r1. note that the thumb opcode will contain ; 28 as the offset5 value. ldrh r4, [r7, #4] ; load into r4 the halfword found at the address fo rmed by ; adding 4 to r7. note that the thumb opcode will contain ; 2 as the offset5 value.
S3C3410X risc microprocessor arm instruction set 3- 83 format 11: sp-relative load/store [7:0] immediate value [10:8] destination register [11] load/store bit 0 = store to memory 1 = load from memory 15 0 1 14 10 0 0 13 12 11 word 8 1 l rd 7 8 figure 3-40. format 11 operation the instructions in this group perform an sp-relative load or store. the thumb assembler syntax is shown in the following table. table 3-18. sp-relative load/store instructions l thumb assembler arm equivalent action 0 str rd, [sp, #imm] str rd, [r13 #imm] add unsigned offset (255 words, 1020 bytes) in imm to the current value of the sp (r7). store the contents of rd at the resulting address. 1 ldr rd, [sp, #imm] ldr rd, [r13 #imm] add unsigned offset (255 words, 1020 bytes) in imm to the current value of the sp (r7). load the word from the resulting address into rd. note : the offset supplied in #imm is a full 10-bit address, but must always be word-aligned (ie bits 1:0 set to 0), since the assembler places #imm >> 2 in the word8 field. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-18. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples str r4, [sp,#492] ; store the contents of r4 at the address ; formed by adding 492 to sp (r13). ; note that the thumb opcode will contain ; 123 as the word8 value.
arm instruction set S3C3410X risc micr oprocessor 3- 84 format 12: load address [7:0] 8-bit unsigned constant [10:8] destination register [11] source 0 = pc 1 = sp 15 0 1 14 10 0 1 13 12 11 word 8 0 sp rd 7 8 figure 3-41. format 12 operation these instructions calculate an address by adding an 10-bit constant to either the pc or the sp, and load the resulting address into a register. the thumb assembler syntax is shown in the following table. table 3-19. load address l thumb assembler arm equivalent action 0 add rd, pc, #imm add rd, r15, #imm add #imm to the current value of the program counter (pc) and load the result into rd. 1 add rd, sp, #imm add rd, r13, #imm add #imm to the current value of the stack pointer (sp) and load the result into rd. note : the value specified by #imm is a full 10-bit value, but this must be word-aligned (ie with bits 1:0 set to 0) since the assembler places #imm >> 2 in field word 8. where the pc is used as the source register (sp = 0), bit 1 of the pc is always read as 0. the value of the pc will be 4 bytes greater than the address of the instruction before bit 1 is forced to 0. the cpsr condition codes are unaffected by these instructions. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-19. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples add r2, pc, #572 ; r2 := pc + 572, but don't set the ; condition codes. bit[1] of pc is forced to zero. ; note that the thumb opcode will ; contain 143 as the word8 value. add r6, sp, #212 ; r6 := sp (r13) + 212, but don't ; set the condition codes. ; note that the thumb opcode will ; contain 53 as the word 8 v alue.
S3C3410X risc microprocessor arm instruction set 3- 85 format 13: add offset to stack pointer [6:0] 7-bit immediate value [7] sign flag 0 = offset is positive 1 = offset is negative 15 0 1 14 10 0 1 13 12 11 sword 7 1 0 0 7 8 9 6 0 0 s figure 3-42. format 13 operation this instruction adds a 9-bit signed constant to the stack pointer. the following table shows the thumb assembler syntax. table 3-20. the add sp instruction l thumb assembler arm equivalent action 0 add sp, #imm add r13, r13, #imm add #imm to the stack pointer (sp). 1 add sp, # -imm sub r13, r13, #imm add #-imm to the stack pointer (sp). note: the offset specified by #imm can be up to ?/+ 508, but must be word-aligned (ie with bits 1:0 set to 0) since the assembler converts #imm to an 8-bit sign + magnitude number before placing it in field sword7. the condition codes are not set by this instruction. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-20. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples add sp, #268 ; sp (r13) := sp + 26 8, but don't set the condition codes. ; note that the thumb opcode will ; contain 67 as the word7 value and s=0. add sp, #? 104 ; sp (r13) := sp ? 104, but don't set the condition codes. ; note that the thumb opcode will contain ; 26 as the word7 value and s=1.
arm instruction set S3C3410X risc micr oprocessor 3- 86 format 14: push/pop registers [7:0] register list [8] pc/lr bit 0 = do not store lr/load pc 1 = store lr/load pc [11] load/store bit 0 = store to memory 1 = load from memory 15 0 1 14 10 0 1 13 12 11 rlist 1 l 0 7 8 9 1 r figure 3-43. format 14 operation the instructions in this group allow registers 0?7 and optionally lr to be pushed onto the stack, and registers 0?7 and optionally pc to be popped off the stack. the thumb assembler syntax is shown in table 3-21. note the stack is always assumed to be full descending. table 3-21. push and pop instructions l b thumb assembler arm equivalent action 0 0 push { rlist } stmdb r13!, { rlist } push the registers specified by rlist onto the stack. update the stack pointer. 0 1 push { rlist, lr } stmdb r13!, { rlist, r14 } push the link register and the registers specified by rlist (if any) onto the stack. update the stack pointer. 1 0 pop { rlist } ldmia r13!, { rlist } pop values off the stack into the registers specified by rlist. update the stack pointer. 1 1 pop { rlist, pc } ldmia r13!, {rlist, r15} pop values off the stack and load into the registers specified by rlist. pop the pc off the stack. update the stack pointer.
S3C3410X risc microprocessor arm instruction set 3- 87 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-21. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples push {r0 ?r4,lr} ; store r0,r1,r2,r3,r4 and r14 (lr) at ; the stack pointed to by r13 (sp) and update r13. ; useful at start of a sub-routine to ; save workspace and return address. pop {r2,r6,pc} ; load r2,r6 and r15 (pc) from the stack ; pointed to by r13 (sp) and update r13. ; useful to restore workspace and return from sub-routine.
arm instruction set S3C3410X risc micr oprocessor 3- 88 format 15: multiple load/store [7:0] register list [10:8] base register [11] load/store bit 0 = store to memory 1 = load from memory 15 0 1 14 10 1 0 13 12 11 rlist 0 l 7 8 rb figure 3-44. format 15 operation these instructions allow multiple loading and storing of lo registers. the thumb assembler syntax is shown in the following table. table 3-22. the multiple load/store instructions l thumb assembler arm equivalent action 0 stmia rb!, { rlist } stmia rb!, { rlist } store the registers specified by rlist, starting at the base address in rb. write back the new base address. 1 ldmia rb!, { rlist } ldmia rb!, { rlist } load the registers specified by rlist, starting at the base address in rb. write back the new base address. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-22. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples stmia r0!, {r3 ?r7} ; store the contents of registers r3 ?r7 ; starting at the address specified in ; r0, incrementing the addresses for each word. ; write back the updated value of r0.
S3C3410X risc microprocessor arm instruction set 3- 89 format 16: conditional branch [7:0] 8-bit signed immediate [11:8] condition 15 0 1 14 1 0 13 12 11 soffset 8 1 7 8 cond figure 3-45. format 16 operation the instructions in this group all perform a conditional branch depending on the state of the cpsr condition codes. the branch offset must take account of the prefetch operation, which causes the pc to be 1 word (4 bytes) ahead of the current instruction. the thumb assembler syntax is shown in the following table. table 2-23. the conditional branch instructions l thumb assembler arm equivalent action 0000 beq label beq label branch if z set (equal) 0001 bne label bne label branch if z clear (not equal) 0010 bcs label bcs label branch if c set (unsigned higher or same) 0011 bcc label bcc label branch if c clear (unsigned lower) 0100 bmi label bmi label branch if n set (negative) 0101 bpl label bpl label branch if n clear (positive or zero) 0110 bvs label bvs label branch if v set (overflow) 0111 bvc label bvc label branch if v clear (no overflow) 1000 bhi label bhi label branch if c set and z clear (unsigned higher)
arm instruction set S3C3410X risc micr oprocessor 3- 90 table 2-23. the conditional branch instructions (continued) l thumb assembler arm equivalent action 1001 bls label bls label branch if c clear or z set (unsigned lower or same) 1010 bge label bge label branch if n set and v set, or n clear and v clear (greater or equal) 1011 blt label blt label branch if n set and v clear, or n clear and v set (less than) 1100 bgt label bgt label branch if z clear, and either n set and v set or n clear and v clear (greater than) 1101 ble label ble label branch if z set, or n set and v clear, or n clear and v set (less than or equal) notes 1. while label specifies a full 9-bit two's complement address, this must always be halfword-aligned (ie with bit 0 set to 0) since the assembler actually places label >> 1 in field soffset8. 2. cond = 1110 is undefined, and should not be used. cond = 1111 creates the swi instruction: see . instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-23. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples cmp r0, #45 ; branch to over-if r0 > 45. bgt over ; note that the thumb opcode will contain ; the number of halfwords to offset. over ; must be halfword aligned.
S3C3410X risc microprocessor arm instruction set 3- 91 format 17: software interrupt [7:0] comment field 15 0 1 14 1 0 13 12 11 value 8 1 7 8 10 9 1 1 1 1 figure 3-46. format 17 operation the swi instruction performs a software interrupt. on taking the swi, the processor switches into arm state and enters supervisor (svc) mode. the thumb assembler syntax for this instruction is shown below. table 3-24. the swi instruction thumb assembler arm equivalent action swi value 8 swi value 8 perform software interrupt: move the address of the next instruction into lr, move cpsr to spsr, load the swi vector address (0x8) into the pc. switch to arm state and enter svc mode. note: value8 is used solely by the swi handler; it is ignored by the processor. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-24. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples swi 18 ; take the software interrupt exception. ; enter supervisor mode with 18 as the ; requested swi number.
arm instruction set S3C3410X risc micr oprocessor 3- 92 format 18: unconditional branch [10:0] immediate value 15 0 1 14 1 1 13 12 11 offset11 0 10 0 figure 3-47. format 18 operation this instruction performs a pc-relative branch. the thumb assembler syntax is shown below. the branch offset must take account of the prefetch operation, which causes the pc to be 1 word (4 bytes) ahead of the current instruction. table 3-25. summary of branch instruction thumb assembler arm equivalent action b label bal label (halfword offset) branch pc relative +/? offset11 << 1, where label is pc +/? 2048 bytes. note: the address specified by label is a full 12-bit two's complement address, but must always be half word aligned (ie bit 0 set to 0), since the assembler places label >> 1 in the offset11 field. examples here b here ; branch onto itself. assembles to 0xe7fe. ; (note effect of pc offset). b jimmy ; branch to 'jimmy'. ; note that the thumb opcode will contain the number of ; halfwords to offset. jimmy ; must be halfword aligned.
S3C3410X risc microprocessor arm instruction set 3- 93 format 19: long branch with link [10:0] long branch and link offset high/low [11] low/high offset bit 0 = offset high 1 = offset low 15 0 1 14 1 1 13 12 11 offset 1 10 h figure 3-48. format 19 operation this format specifies a long branch with link. the assembler splits the 23-bit two's complement half-word offset specified by the label into two 11-bit halves, ignoring bit 0 (which must be 0), and creates two thumb instructions. instruction 1 (h = 0) in the first instruction the offset field contains the upper 11 bits of the target address. this is shifted left by 12 bits and added to the current pc address. the resulting address is placed in lr. instruction 2 (h =1) in the second instruction the offset field contains an 11-bit representation lower half of the target address. this is shifted left by 1 bit and added to lr. lr, which now contains the full 23-bit address, is placed in pc, the address of the instruction following the bl is placed in lr and bit 0 of lr is set. the branch offset must take account of the prefetch operation, which causes the pc to be 1 word (4 bytes) ahead of the current instruction
arm instruction set S3C3410X risc micr oprocessor 3- 94 instruction cycle times this instruction format does not have an equivalent arm instruction. table 3-26. the bl instruction l thumb assembler arm equivalent action 0 bl label none lr := pc + offsethigh << 12 1 temp := next instruction address pc := lr + offsetlow << 1 lr := temp | 1 examples bl faraway ; unconditionally branch to 'faraway' next ; and place following instruction ; address, ie "next", in r14,the link ; register and set bit 0 of lr high. ; note that the thumb opcodes will ; contain the number of halfwords to offset. faraway ; must be half- word aligned.
S3C3410X risc microprocessor arm instruction set 3- 95 instruction set examples the following examples show ways in which the thumb instructions may be used to generate small and efficient code. each example also shows the arm equivalent so these may be compared. multiplication by a constant using shifts and adds the following shows code to multiply by various constants using 1, 2 or 3 thumb instructions alongside the arm equivalents. for other constants it is generally better to use the built-in mul instruction rather than using a sequence of 4 or more instructions. thumb arm 1. multiplication by 2^n (1,2,4,8,...) lsl ra, rb, lsl #n ; mov ra, rb, lsl #n 2. multiplication by 2^n+1 (3,5,9,17,...) lsl rt, rb, #n ; add ra, rb, rb, lsl #n add ra, rt, rb 3. multiplication by 2^n?1 (3,7,15,...) lsl rt, rb, #n ; rsb ra, rb, rb, lsl #n sub ra, rt, rb 4. multiplication by ?2^n (?2, ?4, ?8, ...) lsl ra, rb, #n ; mov ra, rb, lsl #n mvn ra, ra ; rsb ra, ra, #0 5. multiplication by ?2^n?1 (?3, ?7, ?15, ...) lsl rt, rb, #n ; sub ra, rb, rb, ls l #n sub ra, rb, rt multiplication by any c = {2^n+1, 2^n?1, ?2^n or ?2^n?1} 2^n effectively this is any of the multiplications in 2 to 5 followed by a final shift. this allows the following additional constants to be multiplied. 6, 10, 12, 14, 18, 20, 24, 28, 30, 34, 36, 40, 48, 56, 60, 62 ..... (2..5) ; (2..5) lsl ra, ra, #n ; mov ra, ra, lsl #n
arm instruction set S3C3410X risc micr oprocessor 3- 96 general purpose signed divide this example shows a general purpose signed divide and remainder routine in both thumb and arm code. thumb code ;signed_divide ; signed divide of r1 by r0: returns quotient in r0, ; remainder in r1 ;get abs value of r0 into r3 asr r2, r0, #31 ; get 0 or ?1 in r2 depending on sign of r0 eor r0, r2 ; eor with ?1 (0 ffffffff) if negative sub r3, r0, r2 ; and add 1 (sub ?1) to get abs value ;sub always sets flag so go & report division by 0 if necessary beq divide_by_zero ;get abs value of r1 by xoring with 0xffffffff and adding 1 if negative asr r0, r1, #31 ; get 0 or ?1 in r3 depending on sign of r1 eor r1, r0 ; eor wi th ?1 (0 ffffffff) if negative sub r1, r0 ; and add 1 (sub ?1) to get abs value ;save signs (0 or ?1 in r0 & r2) for later use in determining ; sign of quotient & remainder. push {r0, r2} ;justification, shift 1 bit at a time until divisor (r0 value) ; is just <= than dividend (r1 value). to do this shift dividend ; right by 1 and stop as soon as shifted value becomes >. lsr r0, r1, #1 mov r2, r3 b %ft0 just_l lsl r2, #1 0 cmp r2, r0 bls just_l mov r0, #0 ; set accumulator to 0 b %ft0 ; branch into division loop div_l lsr r2, #1 0 cmp r1, r2 ; test subtract bcc %ft0 sub r1, r2 ; if successful do a real subtract 0 adc r0, r0 ; shift result and add 1 if subtract succeeded cmp r2, r3 ; terminate when r2 == r3 (ie we have just bne div_l ; tested subtracting the 'ones' value).
S3C3410X risc microprocessor arm instruction set 3- 97 now fixup the signs of the quotient (r0) and remainder (r1) pop {r2, r3} ; get dividend/divisor signs back eor r3, r2 ; result sign eor r0, r3 ; negate if result sign = ? 1 sub r0, r3 eor r1, r2 ; negate remainder if dividend sign = ? 1 sub r1, r2 mov pc, lr arm code signed_divide ; effectively zero a4 as top bit will be shifted out later ands a4, a1, #&80000000 rsbmi a1, a1, #0 eors ip, a4, a2, asr #32 ;ip bit 31 = sign of result ;ip bit 30 = sign of a2 rsbcs a2, a2, #0 ;central part is identical code to udiv (without mov a4, #0 which comes for free as part of signed entry sequence) movs a3, a1 beq divide_by_zero just_l ; justification stage shifts 1 bit at a time cmp a3, a2, lsr #1 movls a3, a3, lsl #1 ; nb: lsl #1 is always ok if ls succeeds blo s_loop div_l cmp a2, a3 adc a4, a4, a4 subcs a2, a2, a3 teq a3, a1 movne a3, a3, lsr #1 bne s_loop2 mov a1, a4 movs ip, ip, asl #1 rsbcs a1, a1, #0 rsbmi a2, a2, #0 mov pc, lr
arm instruction set S3C3410X risc micr oprocessor 3- 98 division by a constant division by a constant can often be performed by a short fixed sequence of shifts, adds and subtracts. here is an example of a divide by 10 routine based on the algorithm in the arm cookbook in both thumb and arm code. thumb code udiv10 ; take argument in a1 returns quotient in a1, ; remainder in a2 mov a2, a1 lsr a3, a1, #2 sub a1, a3 lsr a3, a1, #4 add a1, a3 lsr a3, a1, #8 add a1, a3 lsr a3, a1, #16 add a1, a3 lsr a1, #3 asl a3, a1, #2 add a3, a1 asl a3, #1 sub a2, a3 cmp a2, #10 blt %ft0 add a1, #1 sub a2, #10 0 mov pc, lr arm code udiv10 ; take argument in a1 retu rns quotient in a1, ; remainder in a2 sub a2, a1, #10 sub a1, a1, a1, lsr #2 add a1, a1, a1, lsr #4 add a1, a1, a1, lsr #8 add a1, a1, a1, lsr #16 mov a1, a1, lsr #3 add a3, a1, a1, asl #2 subs a2, a2, a3, asl #1 addpl a1, a1, #1 addmi a2, a2, #10 mov pc, lr
S3C3410X risc microprocessor system manager 4- 1 4 system manager overview the S3C3410X system manager has the following functionality: arbitrate the bus usage requests from several master blocks, based on a fixed priority. generate the necessary memory control signals for external memory access. for example, if a master block such as dma or the cpu generates an address which corresponds to a dram bank, the dram controller inside system manager should generate the necessary dram control signals (nras, ncas, and so on). support only the big-endian mode. the access to the internal register or the external memory should be done based on the big-endian mode. system manager register the S3C3410X microcontroller has the sfrs, special function register set, to keep the system control information of system manager, cache, dma, uart, and so on. the sfrs have the smrs, system manager register set, to configure the external memory map as well as the access-related option for sdram, dram, sram, rom and extra-i/o control. by utilizing the smr, user can specify the memory type, external bus width, access cycles, necessary control signal timings(nras, ncas, and so on), location of memory bank, and each memory bank size. the smr can provide(or accept) the information of control signals, address, and data which are required by external devices during normal system operation. there are eleven registers to control memory bank (rom, sram, dram/sdram), extra-device control and dram refresh. the S3C3410X can provide up to 128m bytes of address space and each bank can provide up to 16m bytes memory space because each bank can have 24 address pins and 8-bit/16-bit data width. the S3C3410X can also support two external i/o banks. these i/o banks are mapped into the sfr region. the two external i/o bank can give the smart interface between S3C3410X and external i/o device, which will improve the cost, pcb size, and reliability of system.
system manager s3c3 410x risc microprocessor 4- 2 0x07ff0000 128 mbytes (ext. memory space) 0x07ffffff 0x00010000 0x00000000 64 kbytes 64 kbytes undefined region special function register rom region (accessable region) internal sram (note) 0x07ff0fff note: if you use not cache but an internal sram as an internal memory, then the sram area are from 0x07ff0000 to 0x07ff0fff. refer to 5-4 page. figure 4-1. S3C3410X memory map (default map after reset) the S3C3410X can support 128m-byte memory space, which means that the S3C3410X should have an internal 27-bit system address bus. user can allocate the start address of bank by 64k-byte step from 0000000h to 7ffffffh. in other word, each bank can be located anywhere in the 128m-byte address space. the sfrs(special function register) set should occupy the 64k-byte region and the start address of normal memory bank should not be allocated in the region of sfr area. the region of sfr is a kind of memory mapped one and it can not allow the sharing the region with other banks.
S3C3410X risc microprocessor system manager 4- 3 address bus generation the address bus of the S3C3410X is quite different from the general mcu's. although the general mcu does not use the a0 pin for 16-bit data bus width, the S3C3410X always uses the a0 pin regardless of data bus width. in other word, a0 should be connected to the lowest address bit of memory regardless of 16-bit bus width or 8-bit bus width. the bus width of bank 0(boot rom bank) can be configured by external pin(test[1:0]) and the bus width of other bank should be configured by writing the option information in smrs. the memory controller in system manager can generate a0 suitable for 8-bit bus width or 16-bit bus width, automatically. when an 8-bit data bus is selected, the resolution of address bus will be a byte and when a 16-bit is selected, the resolution of address bus will be a half-word. data bus width external address pins : a[23:0] accessible memory size 8-bit sa[23:0] (internal) 16 m bytes 16-bit sa[24:1] (internal) 16 m half-word (32 m bytes) 24-bit 8-bit 16-bit external address bus a[23:0] data bus width configuration (8-bit/16-bit) sa[23:0] 24-bit 24-bit sa[24:1] internal address bus figure 4-2. external address bus generation (a[23:0])
system manager s3c3 410x risc microprocessor 4- 4 n we(not write enable)/ n wbe[1:0](not write byte enable) the nwe is the signal to indicate that the current bus cycle is for writing the data into the memory. but, if user want to write the byte data through 16-bit bus into the memory, there should be byte selection option. for example, user should have cas0 and cas1 signal in case of edo dram. similarly with edo dram case, there should be nwbe[1:0] to select the byte. the x16 sram has nwe for indication of write cycle and lb(lower byte selection)/ub(upper byte selection) for selecting the byte. in this case, nwe from S3C3410X should be connected to we of x16 sram, and nbe[0] and nbe[1] should be connected to lb and ub for the byte selection. differently from x16 sram, in case of x16 sram with two x8 sram, nwbe[0] and nwbe[1] should be connected to the we of sram, respectively. in case of sdram attachment, nwe should be connected to we of sdram and nwbe[1]/nwbe[0] should be connected to dqm[1]/dqm[0]. if user want x8 bus width for external memory access, please have following connection. in case of x8 sram, nwbe[0], not nwe, should be connected to the we of sram. in case of x8 sdram, nwe and nwbe[0] should be connected to the we and dqm of sdram. there is certain case that no more byte access is needed. for example, x16 flash memory does not need byte access through 16-bit bus when user need the programming the data in the flash memory. in this case, please use nwbe[0] instead of nwe to indicate that the current bus cycle is a write cycle
S3C3410X risc microprocessor system manager 4- 5 ncs1 bank 1 bank 0 lower byte ncs0 nbe1 nbe0 x16 sram upper byte ras1 bank 1 bank 0 lower byte ras0 cas1 cas0 dram upper byte nwbe0 nwe nwe nwe figure 4-3. dram(x16) and sram(x16) bank configuration (for x16 data bus) nwbe0 nwbe1 x8 sram ncs0 lower byte upper byte figure 4-4. two sram(x8) configuration (for x16 data bus)
system manager s3c3 410x risc microprocessor 4- 6 system manager & memory controller special function registers system register address configuration register (syscfg) the smrs (system manager registers) have the syscfg (system register address configuration register), which determines the start address(base point) of sfr(special function register) files. the syscfg contains the start address of sfr. if the reset value of syscfg is fff1h, the syscfg is mapped to the address of 07ff0000h. to determine the start address, pick up the syscfg[14:4] and take 16-bit shift left. in this case, syscfg[14:4] is 7ffh and (7ffh << 16) is 07ff0000h, which is the start address of sfr. register offset address r/w description reset value syscfg 0x1000 r/w special function register to determine the start address 0xfff1 syscfg bit description initial state st [0] stall enable: when set to 1, stall operation is enabled. the role of stall option is to insert one cycle wait for the non-sequential access. originally, this feature was adopted to take care of the internal timing issue. so, we are recommending st=0 to get the higher performance. 0 = disable; it is recommended for faster operation 1 = enable; insert an internal wait inside the core logic when non-sequential memory accesses occur. 1 ce [1] cache enable: when set to 1, internal cache will be enabled. when user want to define the internal sram, not cache, the cache should be disabled. if the performance is not critical, user can have cache disable option to reduce the current consumption. 0 = cache disable 1 = cache enable 0 we [2] write buffer enable: when set to 1, the write buffer operation is enabled. to get the higher performance, user should enable the write buffer. the disabling write buffer is for test purpose. 0 = write buffer operation disable 1 = write buffer operation enable 0 reserved [3] reserved 0 sfrsa [14:4] syscfg address (sfrs start address): to determine the start address of sfr, this sfrsa field should be 16-bit left shifted. in other word, the start address of sfr is (sfrsa << 16). 7ff cm [16:15] cache mode: internal 4kb memory can be configured as 4kb cache, 2kb cache/2kb sram, or 4kb sram. 00 = half cache enable (2kb cache, 2kb internal sram) 01 = full cache enable (4kb cache) 10 = disable cache(4kb internal sram) 11 = not used 01
S3C3410X risc microprocessor system manager 4- 7 syscfg bit description initial state ame [17] address mux enable: this bit determines whether or not to use the multiplexed address mode. the multiplexed address mode can generate the address for a[23:16] by using a[15:8] pins. in normal mode, the S3C3410X can support the dedicated pins for a[23:16]. in case of multiplexed address mode, a[23:16] pins can be used as i/o ports. because a[15:8] pins output address data for a[23:16] and a[15:8] by using latch device, as shown in figure 4-5 and figure 4-14. this is option for the pin usage because there are many multiplexed pins in S3C3410X. 0 = normal mode 1 = multiplexed address mode 0 mt0 [19:18] memory type 0: this field determines memory type for bank6 00 = rom/flash/sram 01 = fp dram 10 = edo dram 11 = sync. dram 00 mt1 [21:20] memory type 1: this field determines memory type for bank7 00 = rom/flash/sram 01 = fp dram 10 = edo dram 11 = sync. dram 00
system manager s3c3 410x risc microprocessor 4- 8 bank timing control register (bankcon x : n cs0 ? n cs5) register offset address r/w description reset value bankcon0 0x2000 r/w bank 0 timing control register (for rom/flash) 0x00200070 bankcon1 0x2004 r/w bank 1 timing control register (for rom/flash/sram) 0x0 bankcon2 0x2008 r/w bank 2 timing control register (for rom/flash/sram) 0x0 bankcon3 0x200c r/w bank 3 timing control register (for rom/flash/sram) 0x0 bankcon4 0x2010 r/w bank 4 timing control register (for rom/flash/sram) 0x0 bankcon5 0x2014 r/w bank 5 timing control register (for rom/flash/sram) 0x0 bankconx bit description initial state dbw [0] data bus width: this bit determines the physical data bus width for bankx (bank1,2,3,4,and 5). the physical data bus width of bank0 depends on the configuration of test[1:0] pins. 0 = 8-bit 1 = 16-bit 0 pmc [2:1] these bits determines the page mode configuration for rom access (single mode, 4 data page mode, 8 data page mode, and 16 data page mode). 00 = 1 data 01 = 4 data 10 = 8 data 11 = 16 data 00 sm [3] in certain x16 sram, there are byte selection signals such as lb (lowe byte) and ub (upper byte). in this case, nwe from S3C3410X should be connected to we of sram and nwbe[1:0] from S3C3410X should be connected to ub/lb of sram. 0 = ordinary 1 = x16 type sram 0 tacc [6:4] determine the number of access cycle (tacc). please refer the timing diagram. 000 = disable 001 = 2 clock 010 = 3 clock 011 = 4 clock 100 = 5 clock 101 = 6 clock 110 = 7 clock 111 = 10 clock 111 tacp [8:7] determine the number of page mode access cycle @ page mode (tacp). please refer the timing diagram. 00 = 5 clock 01 = 2 clock 10 = 3 clock 11 = 4 clock 00 reserved [9] reserved 0
S3C3410X risc microprocessor system manager 4- 9 bankconx bit description initial state bap [20:10] memory bank base address pointer: this 11-bit value corresponds to the upper 11 bits from the total 27-bit system address bus. it indicates the start address of the corresponding memory bank(bankx), based on 64k-byte units. the base address pointer value is calculated as follows: base_address_pointer = start_address / 10000h, which is (bap[20:10] << 16). if bap is same with eap, the corresponding memory bankx will be disabled. 00000000000b eap [31:21] memory bank end address pointer: this 11-bit value corresponds to the upper 11 bits from the total 27-bit system address bus. to determine the eap, please refer the below equation : end_address_pointer = (end_address + 1) / 10000h. (end_address of corresponding memory bank+ 1) is equal to (eap << 16). in this case, end_address means the end address of corresponding memory bank by byte address unit, not half- word or word address unit. 00000000000b
system manager s3c3 410x risc microprocessor 4- 10 bank timing control register (bankcon x: nras0 ? n ras 1 ) register offset address r/w description reset value bankcon6 0x2018 r/w bank 6 control register (for fp/edo/sdram/rom/flash/sram) 0x0 bankcon7 0x201c r/w bank 7 control register (for fp/edo/sdram/rom/flash/sram) 0x0 note: bankcon6 and 7 register can have dual configuration, depending on the mt field in syscfg register. in other word, bankcon6 and 7 have the same configuration with bankcon1,2,3,4 and 5 when mt=00, or bankcon6 and 7 have the configuration on dram(fp, edo)/sdram when mt=01, 10, and 11. bankconx bit description initial state memory type = rom or sram [mt=00 in syscfg] dbw [0] data bus width: this bit determines the physical data bus width for bankx (bank6 and 7) 0 = 8-bit 1 = 16-bit 0 pmc [2:1] these bits determines the page mode configuration for rom access (single mode, 4 data page mode, 8 data page mode, and 16 data page mode). 00 = 1 data 01 = 4 data 10 = 8 data 11 = 16 data 00 sm [3] in certain x16 sram, there are byte selection signals such as lb (lowe byte) and ub (upper byte). in this case, nwe from S3C3410X should be connected to we of sram and nwbe[1:0] from S3C3410X should be connected to ub/lb of sram. 0 = ordinary 1 = x16 type sram 0 tacc [6:4] determine the number of access cycle (tacc). please refer the timing diagram. 000 = disable 001 = 2 clock 010 = 3 clock 011 = 4 clock 100 = 5 clock 101 = 6 clock 110 = 7 clock 111 = 10 clock 000 tacp [8:7] determine the number of page mode access cycle @ page mode (tacp). please refer the timing diagram. 00 = 5 clock 01 = 2 clock 10 = 3 clock 11 = 4 clock 00 reserved [9] reserved 0
S3C3410X risc microprocessor system manager 4- 11 bankconx bit description initial state bap [20:10] memory bank base address pointer: this 11-bit value corresponds to the upper 11 bits from the total 27-bit system address bus. it indicates the start address of the corresponding memory bank(bankx), based on 64k-byte units. the base address pointer value is calculated as follows: base_address_pointer = start_address / 10000h, which is (bap[20:10] << 16). if bap is same with eap, the corresponding memory bankx will be disabled 00000000000b eap [31:21] memory bank end address pointer: this 11-bit value corresponds to the upper 11 bits from the total 27-bit system address bus. to determine the eap, please refer the below equation : end_address_pointer = (end_address + 1) / 10000h. (end_address of corresponding memory bank+ 1) is equal to (eap << 16). in this case, end_address means the end address of corresponding memory bank by byte address unit, not half- word or word address unit. 00000000000b
S3C3410X risc microprocessor system manager 4- 12 memory type = fp dram [mt=01 in syscfg] or edo dram [mt=10 in syscfg] dbw [0] data bus width: this bit determines the physical data bus width for bankx (bank6 and 7) 0 = 8-bit 1 = 16-bit 0 can [2:1] column address number for dram (fp and edo dram). 00 = 8-bit 01 = 9-bit 10 = 10-bit 11 = 11-bit 00 tcp [3] cas pre-charge time. please refer the timing diagram. 0 = 1 clock 1 = 2 clock 0 tcas [6:4] cas pulse width. please refer the timing diagram. 000 = 1 clock 001 = 2 clock 010 = 3 clock 011 = 4 clock 100 = 5 clock 101 = not used 110 = not used 111 = disable 000 trc [7] ras to cas delay time. please refer the timing diagram. 0 = 1 clock 1 = 2 clock 0 trp [9:8] ras pre-charge time. please refer the timing diagram. 00 = 1 clock 01 = 2 clock 10 = 3 clock 11 = 4 clock 00 bap [20:10] memory bank base address pointer: this 11-bit value corresponds to the upper 11 bits from the total 27-bit system address bus. it indicates the start address of the corresponding memory bank(bankx), based on 64k-byte units. the base address pointer value is calculated as follows: base_address_pointer = start_address / 10000h, which is (bap[20:10] << 16). if bap is same with eap, the corresponding memory bankx will be disabled 00000000000b eap [31:21] memory bank end address pointer: this 11-bit value corresponds to the upper 11 bits from the total 27-bit system address bus. to determine the eap, please refer the below equation : end_address_pointer = (end_address + 1) / 10000h. (end_address of corresponding memory bank+ 1) is equal to (eap << 16). in this case, end_address means the end address of corresponding memory bank by byte address unit, not half- word or word address unit. 00000000000b
S3C3410X risc microprocessor system manager 4- 13 memory type = sync. dram [mt=11 in syscfg] dbw [0] data bus width : this bit determines the physical data bus width for bankx(bank6 and 7) 0 = 8-bit 1 = 16-bit 0 can [2:1] column address number of sdram. 00 = 8-bit 01 = 9-bit 10 = 10-bit 11 = 11-bit 00 reserved [6:3] reserved 0000 trc [7] ras to cas delay time. please refer the timing diagram. 0 = 1 clock 1 = 2 clock 0 trp [9:8] ras pre-charge time. please refer the timing diagram. 00 = 1 clock 01 = 2 clock 10 = 3 clock 11 = 4 clock 00 bap [20:10] memory bank base address pointer: this 11-bit value corresponds to the upper 11 bits from the total 27-bit system address bus. it indicates the start address of the corresponding memory bank(bankx), based on 64k-byte units. the base address pointer value is calculated as follows: base_address_pointer = start_address / 10000h, which is (bap[20:10] << 16). if bap is same with eap, the corresponding memory bankx will be disabled 00000000000b eap [31:21] memory bank end address pointer: this 11-bit value corresponds to the upper 11 bits from the total 27-bit system address bus. to determine the eap, please refer the below equation: end_address_pointer = (end_address + 1) / 10000h. (end_address of corresponding memory bank+ 1) is equal to (eap << 16). in this case, end_address means the end address of corresponding memory bank by byte address unit, not half-word or word address unit. 00000000000b
system manager s3c3 410x risc microprocessor 4- 14 external device control registers (extcon n ) the S3C3410X can support the connection with two external i/o devices without any additional logic. it is very cost effective, because the additional address decoding logic is not necessary. the smart connection between S3C3410X and external i/o device can improve the cost, pcb size, and reliability of system. differently from the normal memory banks (8 memory banks in S3C3410X), S3C3410X defines the external i/o banks in sfr (special function register), extport, extdat0, and extdat1. extdat0 and extdat1 have 64 bytes addressing region, respectively. to read the data from the external i/o device, you should execute the load instruction by issuing the address (sfr start address + i/o bank offset), extport, extdat0 or extdat1. then, the data will be latched in the data register. to write the data into the external i/o device, you should execute the store instruction by issuing the address (sfr start address + i/o bank offset), extport, extdat0 or extdat1. then, the data will be written into the selected address, and the data will be written into the external i/o device. these operation is automatically executed by the memory controller. register offset address r/w description reset value extcon0 0x2030 r/w extra device control register 0 (for external output port) 0x0 extcon1 0x2034 r/w extra device control register 1 (for external chip selection) 0x0 extconx bit description initial state dw [1:0] data bus width: this bit determines the physical data bus width for extbankx (external bank0 and 1) 00 = disable bank 01 = 8-bit 10 = 16-bit 11 = not used 00 tcos [4:2] set-up time of necs before noe. please refer the timing diagram. 000 = 0 clock 001 = 1 clock 010 = 2 clock 011 = 3 clock 100 = 4 clock 101 = 5 clock 110 = 6 clock 111 = 7 clock 000 tcoh [10:8] hold time of necs after noe. please refer the timing diagram. 000 = 0 clock 001 = 0 clock 010 = 2 clock 011 = 3 clock 100 = 4 clock 101 = 5 clock 110 = 6 clock 111 = 7 clock 000 tacc [13:11] access times (noe low time) 000 = 0 clock 001 = 2 clock 010 = 3 clock 011 = 4 clock 100 = 5 clock 101 = 6 clock 110 = 7 clock 111 = 8 clock 000
S3C3410X risc microprocessor system manager 4- 15 external output port register (extport) you can use an external output latch device as an output port without any additional address logic for decoding logic, because S3C3410X have the nwrexp pin. when you write any data to extport register, nwrexp pin outputs a write strobe signal to interface with an external output latch device for latching the output data. that is, the access signal to the external output latch device is controlled by writing any data to extport register. for example, if you write 0xff to extport, memory controller outputs a write strobe signal in nwrexp pin and 0xff in data bus. at this time, the access time is controlled by the extra device control register, extcon0 only. (refer to figure 4-21) when mds mode is selected, this nwrexp pin is used as a write strobe signal for an external output latch, which is emulated for port 7 output. register offset address r/w description reset value extport 0x203e r/w external port data register 0x0 external chip selection data register (extdatx) you can directly access to the external device as external memory without any additional address decoding logic because S3C3410X have the external device control logic, necs0 and necs1 pins. these pins output the external device selection signals. external device is accessed by the memory controller when the data is read/write from/to extdat0 or extdat1. that is, if you read/write the data from/to extdat0 or extdat1, the memory controller automatically outputs necs0 or necs1, the selected address and data. for example, if you write 0xff to 0x206c in extdat0, memory controller outputs necs0 signal, 0x206c in address bus and 0xff in data bus. at this time, the access time of extdat0 and extdat1 are controlled by the extra device control register1, extcon1 only. (refer to figure 4-21) when p2.7 or p3.7 is used as a normal input/output mode, necs0 or necs1 can not support extra chip selection. register offset address r/w description reset value extdat0 0x202c r/w extra chip selection data register 0 ? 0x206c 0x20ac 0x20ec 0x212c : : 0x2fec extdat1 0x202e r/w extra chip selection data register 1 ? 0x206e 0x20ae 0x20ee 0x212e : : 0x2fee
system manager s3c3 410x risc microprocessor 4- 16 dram/sdram self refresh control register (refcon) register offset address r/w description reset value refcon 0x2020 r/w dram/sdram refresh control register 0x1 refcon bit description initial state vsmr [0] validity of special memory register (smr): whenever cpu access one of system manager registers(smr), vsmr bit will be cleared automatically and all memory bank will be disabled. to re-activate the memory bank, vsmr bit should be set to 1 by using stmia instruction(data in the cpu registers can be stored into the memory or memory mapped register by single instruction). in other word, user should update the necessary configuration in smr as well as setting vsmr bit in refcon register, simultaneously. to do the simultaneous updating, user should use the stmia instruction, which can transfer the cpu register data into smr. the last data transfer from cpu register should be data transfer to refcon register to set the vsmr bit. 0 = not accessible to memory bank 1 = accessible to memory bank 1 rc [11:1] refresh interval (refresh count): this rc field determine the dram refresh period by below equation. refresh period = (2 11 ? refresh count + 1) / mclk ex) if refresh period is 15.6us and mclk is 33mhz, the refresh count should be as follows: refresh count = 2 11 + 1 ? 33 x 15.6 = 1019 = 1111111011b 00000000000b ren [12] refresh enable: if bank 6 and/or bank 7 are configured to have dram bank by mt[1:0] field in syscfg register, this bit has following option. 0 = disable dram refresh. 1 = enable dram refresh. if bank 6 and/or bank 7 are configured to have sdram bank by mt[1:0] field in syscfg register, this bit has following option. 0 = disable sdram auto-refresh. 1 = enable sdram auto refresh. 0 tch [15:13] cas hold time. please refer the timing diagram. 000 = 1 clock 001 = 2 clock 010 = 3 clock 011 = 4 clock 100 = 5 clock other = not used 000 tcsr [16] cas set-up time. please refer the timing diagram. 0 = 1 clock 1 = 2 clock 0
S3C3410X risc microprocessor system manager 4- 17 memory access and i/o timing diagram clk a[15:8] nas ncsx noe data (write) data (read) tash = 0.77ns (nas to a hold-time) @ typ condition when sram/rom interface and enables address mux a[15:8] outputs upper address during 1-cycle. at this time, nas is enabled during 1-cycle. the nas signal occurs only in case the current upper address is changed from the previous one. (that is to say, a[23:16] is different from the previous a[23:16].) when nas occurs, noe and nwbe[1:0] signals are delayed for 1- cycle, but, the ncsx is enabled. when upper address outputs, data(write) is enabled. but data(read) is delayed for 1-cycle because noe is delayed. nwbe lower address +1 lower address upper address no upper address, if upper address is same. figure 4-5. S3C3410X multiplexed address mode timing diagram
system manager s3c3 410x risc microprocessor 4- 18 tacp mclk a[23:0] ncsx noe nwbe data (write) data (read) tacc tacc = 4 cycles, tacp = 3 cycles figure 4-6. S3C3410X ncs timing diagram
S3C3410X risc microprocessor system manager 4- 19 row address mclk addr nrasx ncasx noe nwe data(r) @fp data(r) @edo data (write) trp trcd tcas tcp column address column address column address column address trp = 1 cycle, trcd = 1 cycle, tcas = 1 cycle, tcp = 1 cycle figure 4-7. S3C3410X dram timing diagram
system manager s3c3 410x risc microprocessor 4- 20 da db dc dd de ca cb cc cd ce ra ra ba ba ba ba ba ba ba sclk scke nscs nsras nscas addr ba addr nwe data (cl=2) bank precharge row active write raed (cl = 2 cycles, bl = 1 cycle) trcd trp trp = 2 cycles, trcd = 2 cycles, cl = 2 cycles figure 4-8. S3C3410X sdram timing diagram
S3C3410X risc microprocessor system manager 4- 21 mclk addr ncsx noe nwe nwait data (read) data (write) check the nwaait signal tacc external wait fetch data tacc = 3 cycles, nwait = 3 cycles figure 4-9. S3C3410X ncs timing diagram with nwait
system manager s3c3 410x risc microprocessor 4- 22 mclk addr necs0 or necs1 noe nwbe0 or nwbe1 nwait data (read) data (write) check the nwaait signal tacc external wait fetch data tcos = 2 cycles, tacc = 3 cycles, tcoh = 1 cycle, nwait = 2 cycles tcos tcoh figure 4-10. S3C3410X necs timing diagram with nwait
S3C3410X risc microprocessor system manager 4- 23 memory interface signal connection method pin name memory type description noe any type memory read strobe signal nwbe0 single 8 flash rom/eeprom/dram/sram memory write strobe signal two 8 flash rom/eeprom/dram/sram memory lower byte write strobe signal single 16 sram memory lower byte signal nwbe1 two 8 flash rom/eeprom/dram/sram memory upper byte write strobe signal single 16 sram memory upper byte signal nwe 16 sram/sdram memory write strobe signal memory connection example memory configuration type mcu pin memory pin 8/ 16 rom (mcu data bus: 8/ 16) noe noe single x8 flash rom/eeprom or single x8 sram noe noe (mcu data bus: 8) nwbe0 nwe two x8 flash rom/eeprom or two 8 sram noe noe (mcu data bus: 16) nwbe0 nwe of lower byte nwbe1 nwe of upper byte 16 sram noe noe (mcu data bus: 16) nbe0 nlb nbe1 nub nswe nwe single 8 dram vdd noe (mcu data bus: 8) nras0 nras ncas0 ncas nwbe0 nwe two 8 dram vdd noe (mcu data bus: 16) nras0 nras ncas0 ncas of lower byte ncas1 ncas of upper byte nwbe0 nwe single 16 dram vdd noe (mcu data bus: 16) nras0 nras ncas0 nlcas ncas1 nucas nwbe0 nwe
system manager s3c3 410x risc microprocessor 4- 24 memory configuration type mcu pin memory pin two 16 dram vdd noe (mcu data bus: 16) nras0 nras of lower bank nras1 nras of upper bank ncas0 nlcas ncas1 nucas nwbe0 nwe single 8 sdram noe noe (mcu data bus: 8) nscs nscs nsrac nsrac nscas nscas dqm0 dqm nwe nwe scke scke sclk sclk two 8 sdram noe noe (mcu data bus: 16) nscs nscs nsrac nsrac nscas nscas dqm0 dqm of lower byte dqm1 dqm of upper byte nwe nwe scke scke sclk sclk single 16 sdram noe noe (mcu data bus: 16) nscs nscs nsrac nsrac nscas nscas dqm0 ldqm dqm1 udqm nwe nwe scke scke sclk sclk
S3C3410X risc microprocessor system manager 4- 25 memory configuration examples a[15:8] d[7:0] noe ncs0 S3C3410X program memory 64kb rom (eep/eprom) 8 8 v dd nwe a[7:0] 8 a[15:8] d[7:0] a[7:0] noe ncs figure 4-11. 64k 8 rom memory only a[15:8] d[7:0] noe ncs0 S3C3410X program memory 64kb rom (eep/eprom) 8 8 v dd nwe program memory 16kb rom a[7:0] 8 ncs a[15:8] d[15:8] a[7:0] noe a[15:8] d[7:0] a[7:0] noe ncs d[15:8] 8 v dd nwe figure 4-12. 64k 16 rom memory only
system manager s3c3 410x risc microprocessor 4- 26 a[15:8] d[7:0] noe ncs0 S3C3410X program memory 64kb rom (eep/eprom) 8 8 v dd nwe data memory 16kb sram (eep/flash rom) ncs1 nwbe0 nwe a[7:0] 8 ncs a[15:8] d[7:0] a[7:0] noe a[15:8] d[7:0] a[7:0] noe ncs figure 4-13. 64kb 8 program rom & 64kb 8 data memory a[15:8] d[7:0] noe ncs0 S3C3410X program memory 16mb rom (eep/eprom) 8 8 v dd nwe data memory 16mb sram (eep/flash rom) ncs1 nwbe0 nwe a[7:0] 8 ncs a[23:16] a[15:8] d[7:0] a[7:0] noe a[23:16] a[15:8] d[7:0] a[7:0] noe ncs 8-bit latch nas figure 4-14. 16mb 8 program memory & 16mb 8 data memory
S3C3410X risc microprocessor system manager 4- 27 a[23:16] (port 1) a[15:8] d[7:0] noe ncs0 S3C3410X program memory 16mb rom (eep/eprom) 8 8 8 v dd nwe data memory 16mb sram (eep/flash rom) ncs1 nwbe0 nwe a[7:0] 8 ncs a[23:16] a[15:8] d[7:0] a[7:0] noe a[23:16] a[15:8] d[7:0] a[7:0] noe ncs figure 4-15. 16mb 8 program memory & 16mb 8 data memory a[23:16] (port 4) a[15:8] d[7:0] noe ncs0 S3C3410X program memory 16mb rom (eep/eprom) 8 8 8 v dd nwe data memory 16mb sram (eep/flash rom) ncs1 nwbe0 nwe a[7:0] 8 ncs a[23:16] a[15:8] d[7:0] a[7:0] noe a[23:16] a[15:8] d[7:0] a[7:0] noe ncs figure 4-16. 16mb 8 program memory & 16mb 8 data memory
system manager s3c3 410x risc microprocessor 4- 28 a[23:16] a[15:8] d[7:0] noe ncs0 S3C3410X program memory 8m 16-bit rom (eep/eprom) 8 8 8 v dd nwe data memory 8m 8-bit sram d[15:8] ncs1 nwbe0 ncs a[7:0] 8 nwbe1 8 nwe a[23:16] a[15:8] d[7:0] d[15:8] a[7:0] noe a[23:16] a[15:8] d[7:0] d[15:8] a[7:0] noe ncs ncs nwe figure 4-17. 8mb 16 program memory & two 8mb 8 data memory a[23:16] a[15:8] d[7:0] noe ncs0 S3C3410X program memory 8m 16bit rom (eep/eprom) 8 8 8 v dd nwe data memory 8m 16bit sram d[15:8] ncs1 nwbe0 nlb a[7:0] 8 nwbe1 ncs 8 nub nwe nswe a[23:16] a[15:8] d[7:0] d[15:8] a[7:0] noe a[23:16] a[15:8] d[7:0] d[15:8] a[7:0] noe ncs figure 4-18. 8mb 16 program memory & 8mb 16 data memory (sram)
S3C3410X risc microprocessor system manager 4- 29 a[23:16] a[15:8] d[7:0] noe ncs0 S3C3410X program memory 8m 16bit rom (eep/eprom) 8 8 8 v dd nwe data memory 4m 8bit dram d[15:8] nras nwbe0 nras a[7:0] 8 8 nwe a[11:8] d[7:0] d[15:8] a[7:0] noe a[23:16] a[15:8] d[7:0] d[15:8] a[7:0] noe ncs nras nwe ncas ncas ncas0 ncas1 figure 4-19. 8mb 16 program memory & two 4mb 8 data memory (dram) a[23:16] a[15:8] d[7:0] noe ncs0 S3C3410X program memory 8m 16bit rom (eep/eprom) 8 8 8 v dd nwe data memory 4m 16bit dram d[15:8] nras nwbe0 nras a[7:0] 8 8 nwe a[11:8] d[7:0] a[7:0] noe a[23:16] a[15:8] d[7:0] d[15:8] a[7:0] noe ncs nlcas ncas0 ncas1 nucas d[15:8] figure 4-20. 8mb 16 program memory & 4mb 16 data memory (dram)
system manager s3c3 410x risc microprocessor 4- 30 a[23:16] a[15:8] d[7:0] noe ncs0 S3C3410X program memory 8m 16bit rom (eep/eprom) 8 8 8 v dd nwe data memory 4m 16bit dram d[15:8] nras1 nwbe0 nras a[7:0] 8 8 nwe a[11:8] d[7:0] a[7:0] noe a[23:16] a[15:8] d[7:0] d[15:8] a[7:0] noe ncs nras nwe ncas0 ncas1 nlcas nucas nlcas nucas nras2 d[15:8] figure 4-21. 8mb 16 program memory & two 4mb 16 data memory (dram)
S3C3410X risc microprocessor system manager 4- 31 a[23:16] a[15:8] d[7:0] noe ncs0 S3C3410X program memory 8m 16bit rom (eep/eprom) 8 8 8 vdd nwe data memory 2m 8bit with 4 banks sdram d[15:8] nscs0 ncs a[7:0] 8 8 a[11:8] d[7:0] d[15:8] a[7:0] noe a[23:16] a[15:8] d[7:0] d[15:8] a[7:0] noe ncs nras nsras ncas nscas nwe nwe a[13:12] ba[1:0] dqm0 dqm0 sclk sclk scke scke dqm1 dqm1 figure 4-22. 8mb 16 program memory & two 2mb 8 with 4 banks sdram
system manager s3c3 410x risc microprocessor 4- 32 a[23:16] a[15:8] d[7:0] noe ncs0 S3C3410X program memory 8m 16bit rom (eep/eprom) 8 8 8 vdd nwe data memory 1m 16bit with 4 banks sdram d[15:8] nscs0 ncs a[7:0] 8 8 a[11:8] d[7:0] d[15:8] a[7:0] noe a[23:16] a[15:8] d[7:0] d[15:8] a[7:0] noe ncs nras nsras ncas nscas nwe nwe a[13:12] ba[1:0] dqm0 ldqm sclk sclk scke scke ncs nscs1 dqm1 udqm figure 4-23. 8mb 16 program memory & two 1mb 16 with 4 banks sdram
S3C3410X risc microprocessor system manager 4- 33 74hct374 74hct574 nle servo processor noe nwr ncs servo processor noe nwr ncs 8 8 d[7:0] noe nwbe0 necs0 necs1 S3C3410X nwrexp output (external output) nwbe1 figure 4-24. nwrexp, necs0 and necs1 application example in normal mode
system manager s3c3 410x risc microprocessor 4- 34 notes
S3C3410X risc microprocessor unified cache & internal sram 5- 1 5 unified cache & internal sram overview the S3C3410X has internal 4k-byte unified (instruction/data) cache. the cache architecture is based on two- way set associative and use the lru(least recently used) as cache replacement policy. to maintain the data coherence between main memory and cache, the cache controller should write the data into the main memory whenever the cpu update the data in cache memory. because the cache line size is 4 word, there should be four word of memory fetch from main memory when cache miss happens. the cost-effective cache architecture can maintain the good hit ratio by investing the reasonable h/w inside the chip. the performance difference between cache-on and cache-off is dramatically big. when cache is off, there is always instruction fetch from main memory. if we assume it takes 4 cycles for instruction fetch from main memory, the cpu performance will be dropped to 25% of the case of 10% cache hit due to the only instruction fetch from external memory. the 100% cache hit means that the cpu can fetch the instruction from memory within one cycle, i.e., zero wait. usually, the user should turn on the cache to get the higher performance. but, if user does not want higher performance, the cache can be turn off to reduce the power consumption. if you turn the cache off and do not use the internal memory as sram, the power consumption will be reduced by 40%. the S3C3410X can support the optional cache configuration. internal 4kb memory can be configured as 4kb cache memory, 2kb cache/2kb sram, or 4kb sram. users can select these options suitable for their application. the caching area of external memory can be determined to non-cache region by having the configuration. when the cpu access the non-cacheable region, these data should not be cached. usually, the program and data area should be in cacheable region to get higher performance. but, the control-purposed data, for example, the data handling by dma, should be in non-cacheable region. if the control data is in the cacheable region, if some of these data are cached into the cache memory, and if dma update the data in the external memory of cacheable region, we can not guarantee the data coherence between data in cache memory and in external memory. summarizing, users should always be aware of the memory allocation for non-cacheable and cacheable region. the S3C3410X can support the 128mb addressing range and it means that the internal address a[26:0] are only effective even if the cpu can generate the a[31:0] of the internal address. if the s/w generate the address beyond this range, the cache controller and the memory controller will treat this address as special case. the reality is as follow. the cache controller accepts the address of a[27:0] and determine whether this access should be cached, or not when a[27]=0. in other word, the access should be cached if the a[26:0] is corresponding to the cacheable region and should not be cached if the a[26:0] is corresponding to the non-cacheable region. if a[27] = 1, the cache controller treat this access as non-cacheable access even if the a[26:0] is corresponding to cacheable or non-cacheable region. when a[27]=1 and the a[26:0] is corresponding to the cacheable region, the cache controller should treat this access as non-cacheable access and the memory controller should execute the memory access by using a[26:0] address. the cache controller discard the address of a[31:28] and the memory controller also discard the address of a[31:27].
unified cache & internal sram S3C3410X risc microprocessor 5- 2 set 1 cache = 4 instruction/data (128-bits) set 0 cache = 4 instruction/data (128-bits) decoder height = 128 (64) 7 (6) 32 2 enable non-cacheable control 2 32 32 instr3 instr2 instr1 instr0 32-bit 7 (6) 31 tag address: 16-bits (17-bits) 27 0 10 9 4 3 2 1 26 28 11 switch cs set 1 tag set 0 tag 16 (17) 2 16 (17) 16 (17) instr3 instr2 instr1 instr0 32-bit figure 5-1. cache memory configuration
S3C3410X risc microprocessor unified cache & internal sram 5- 3 cache operation cache organization the S3C3410X cache has a 4kb or 2kb cache memory and tag ram. the cache architecture consists of 2-way set associative, has 4 word as line size, and uses the lru replacement policy. to maintain the data coherence between cache and main memory, the S3C3410X supports the wt(write through). the tag ram has a 2-bit cs(cache status) field as well as tag data for set 0 and 1 as shown in figure 5-1. each tag set has a 16-bits/17- bits tag address of a[26:11] / a[26:10] for 4kb /2kb cache if the address of a[26:0] is cached in the cache memory. the 2-bit cs indicates the validity of cached data of the corresponding cache memory line. it is also used for the cache replacing algorithm and for selecting the data coming from set 0 and 1. because the cache consists of 2-way set associative, each set should have 2kb. the one line is 4-word(4 32 = 128bit), and there should be 128 lines in each set. if users specify the 2kb cache, one line is 4-word(4 32 = 128bit) and there should be 64 lines in each set. the tag and cache array memory are mapped to the specific address range and users can access these memory by s/w, which will be explained in cache flush. cache replace operation after the system is initialized, the value of cs is set to "00", notifying that the memory content in set 0 and 1 are invalid. when a cache fill occurs, the value of cs is changed to "01" at the specified line, which notifies that the set 0 is only valid. when the subsequent cache fill occurs, the value of cs will be "11" at the specified line, which notifies that the memory content in both set 0 and set 1 are valid. when the memory content in both set 0 and set 1 are valid, there should be cache replacement when the cache miss happens. during the miss cycle, the value of cs should be changed to "10" at the specified line, notifying that the memory content in set 0 will be replaced. after the completion of miss cycle, the value of cs will be changed to "11", again because the specified cache was re-filled. if there happens other miss cycle on the same line, the value of cs should be changed to "01" at the specified line, notifying that the memory content in set 1 will be replaced. after the completion of miss cycle, the value of cs will be changed to "11", again because the specified cache was re-filled. to indicate the least recently used line, there is an internal toggling bit which determines that the recent access was to set 0 or set 1. ; set0, set1 all invalid ; cache miss occurs ; set0 = valid and set1 = invalid it does not change status on hit ; read miss ; av_s1d = all valid and set1 dirty. "dirty" means to be accessed just before. it does not change the status on hit. ; av_s0d = all valid and set0 is dirty. s0 only: 01 miss hit reset(/) invalid: 00 av-s1d: 11 hit 1 av-s0d: 10 miss hit 0 miss or hit 1 miss or hit 0 figure 5-2. cs-bit status diagram
unified cache & internal sram S3C3410X risc microprocessor 5- 4 cache disable operation the S3C3410X cache can support the programmable entire-cache-enable/disable mode. users can enable the cache by setting the value of ce bit in syscfg to "1", and disable it by clearing the value of syscfg to "0". when the cache disable mode is selected, the instruction and data should always be fetched from the external memory. the S3C3410X can also support the option for cache size of 0kb, 2kb, and 4kb by the cache mode bits(syscfg[16:15]]). when the reset, the default status is 4kb cache. if users specify the less cache size than 4kb, the remained memory can be used as an internal sram. that is to say, if you want to use the internal memory as an internal sram, the memory allocation table of the internal sram is as follows: item address comment internal sram (sfr start address) ? (sfr start address + 0x7ff) 2kb (sfr start address + 0x800 ) ? (sfr start address + 0xfff) 2kb the S3C3410X can support the wt(write through) to maintain the coherency between the cache and main memory. when ever the cpu updates the cache memory, the cache controller should issue the updating cycle of main memory content through the memory controller, automatically. users should also be cautious about the data coherency when they specify the cacheable region. for example, if the dma has the possibility to update the memory content, the memory region should be non-cacheable. write buffer operation the S3C3410X has four write buffer register to enhance the performance. the role of write buffer is as follows: when the cpu try to write its data into the external memory, the memory controller can not execute the memory cycle if some other master, for example, dma is using the external bus. in this case, the performance will be degraded if the cpu and memory controller should wait the bus free. to avoid this situation, the S3C3410X has internal four-depth write buffer register. in this case, the cpu should write its data into the write buffer register and execute its next operation. if the bus is free, the write buffer register requests the bus cycle to memory controller. the write buffer also need the tag address of a[26:0] because the write buffer should return the accessed data to the cpu when the cpu requests the read operation again before the data update into the main memory.
S3C3410X risc microprocessor unified cache & internal sram 5- 5 26 [31:0] write buffer data data to be written into external memory [1:0] mas 00 = 8-bit data mode 01 = 16-bit data mode 10 = 32-bit data mode 11 = not used [24:0] address indicates the address of write buffer 0 31 0 write buffer data mas address 1 0 figure 5-3. write buffer configuration
unified cache & internal sram S3C3410X risc microprocessor 5- 6 cache flushing the cache content as well as tag at the specific line can be accessed by s/w. in S3C3410X, the memory array of set 0 is mapped to the address of 0x10000000 ? 0x100007ff, which is 2kb size. similarly, the memory array of set 1 is mapped to the address of 0x10800000 ? 0x108007ff, which is also 2kb size. the tag array is also mapped to the address of 0x11000000 ? 0x110001ff, which is 512b size. as we explained in previous chapter, the width of tag data is total 36-bit, which consists of 2bit cs, 17/16-bit tag data for 2kb/4kb for set 0, and 17/16-bit tag data for 2kb/4kb for set 1. in detail, the 16-bit tag data(tag[15:0]) of set 1 and 16-bit tag data(tag[15:0]) of set 1 is mapped to the address of 0x11000000. the cs field of the tag is mapped to the address of 0x11000004. in this case, cs[1] and cs[0] are corresponding to the data bus of d[31] and d[30]. if user specify the 2kb cache size, lower 16-bit tag data of set 1 and lower 16-bit tag data of set 0 is mapped to the address of 0x11000000. the remained cs field, upper tag bit of set 1 and upper tag bit of set 0 are mapped to the address of 0x11000004. in this case, cs[1], cs[0], tag[16] for set 1, and tag[16] for set 0 are corresponding to the data bus of d[31], d[30], d[29], and d[28]. the next line will be corresponding to the address of 0x11000008, 0x11000010, and so on. the memory allocation table of the tag ram and set 0, 1 cache memory is as follows: item address comment set 0 0x10000000 ? 0x100007ff 2kb set 1 0x10800000 ? 0x108007ff 2kb tag ram 0x11000000 ? 0x110001ff 512b note: cache flushing must be executed only in the cache disable mode. non-cache area control bit the S3C3410X can support the 128mb addressing range and it means that the internal address a[26:0] are only effective even if the cpu can generate the a[31:0] of the internal address. if the s/w generate the address beyond this range, the cache controller and the memory controller will treat this address as special case. the reality is as follow. the cache controller accepts the address of a[27:0] and determine whether this access should be cached, or not when a[27]=0. in other word, the access should be cached if the a[26:0] is corresponding to the cacheable region and should not be cached if the a[26:0] is corresponding to the non-cacheable region. if a[27] = 1, the cache controller treat this access as non-cacheable access even if the a[26:0] is corresponding to cacheable or non-cacheable region. when a[27]=1 and the a[26:0] is corresponding to the cacheable region, the cache controller should treat this access as non-cacheable access and the memory controller should execute the memory access by using a[26:0] address. the cache controller discard the address of a[31:28] and the memory controller also discard the address of a[31:27].
S3C3410X risc microprocessor unified cache & internal sram 5- 7 note: non-cacheable area is the mirroring space of cacheable. cacheable area (64m halfword) 0x0000000 cacheable 0x0010000 0x0020000 0x7ffffff 0x8000000 non-cacheable 0x8010000 0x8020000 0xfffffff non-cacheable area (64m halfword) figure 5-4. non-cacheable area
unified cache & internal sram S3C3410X risc microprocessor 5- 8 notes
S3C3410X risc microprocessor dma 6- 1 6 dma (direct memory access) overview the S3C3410X has two general direct memory access channels (dma0, dma1) which performs the data transfer between the following source/destination and destination/source without cpu intervention: memory(or internal sram) and memory (or internal sram) uart and memory (or internal sram) sio and memory (or internal sram) sfr and memory (or internal sram) sfr and sfr (including uart, sio, ext. i/o, timer1/3) the on-chip dma controller can be started by software, by two external dma requests(ndreq0, ndreq1) or by sio 0, sio1, uart, timer1, and timer3. the dma operation can also be stopped and restarted by software. the cpu can recognize the completion of dma operation by software polling or interrupt request from dma. the source and/or destination address can be increased or decreased during dma operation and the dma can support the transfer size by byte, half-word, and word unit. ndreq0 uart sio0 sio1 ndreq1 dma0 dma1 ndreq ndreq ndack ndack mode select system bus ndack0 timer1/3 ndack1 figure 6-1. dma0/dma1 unit block diagram
dma S3C3410X risc m icroprocessor 6- 2 dma operation the dma operation can be summarized as follows: dma transfer bus arbitration control starting/stopping dma transfer dma transfer the dma(direct memory access) can transfer the data directly between source and destination. the source or the destination should be memory including internal sram, uart, sio, or other sfr. the external devices can request the dma service by activating the ndreq0/1 signal. the operation of dma channel should be programmed by configuring the dma control registers, which contain the control information such as the direction of the source address, or destination address, and transfer size. the uart, sio, timer1/3, external devices and software can request dma service. for example, the uart, sio, and timer1/3 can request the dma service when they are ready to need the dma operation. for example, the uart can request the dma service to dma controller when the uart finish receiving the data from port and ready to send the received data to external memory by using dma. differently from internal devices, the external device can activate the ndreq0/1 signal to request the dma service to S3C3410X. to make the dma ready for its operation, users should specify the necessary control information such as source/destination address, transfer size, and transfer count. after the completion of these configuration, user can start the dma operation by software. bus arbitration control because the dma operation need the occupation of bus usage, the arbitration should be essential. as well as dma, the memory controller inside chip need the bus usage. if there happens simultaneous bus request among master devices, there should be arbitration process in S3C3410X. the S3C3410X can do the arbitration process base on fixed priority. the priority of these bus master devices is as follows: bus master type priority memory controller(dram/sdram refresh) 1 dma0 2 dma1 3 write buffer 4 cpu core 5
S3C3410X risc microprocessor dma 6- 3 starting/stopping dma transfer the dma can start its operation of transferring the data when the dma controller receives the request from the ndreq signal through external pin, request from uart, request from sio, or request from timer1/3. in case of data transfer between memories, the dma can also start its operation when the user write the start bit(run bit) in dma control register. when the entire data transfer specified in dmacnt has been finished, the dma goes into the idle mode. if users want to perform another dma operation, the configuration of dma operation should be programmed again. the users can stop the dma operation before its complete termination. by clearing the start bit(run bit), the users can stop the dma operation even if the specified dma operation is not finished. when users stop the dma operation, there will be interrupt generation which depends on the si(stop interrupt) bit in dma control register. if si bit is 0 in dma control register, there will be dma operation stop without the interrupt generation. if users want to resume the dma operation, users should re-run the dma operation by setting the start bit(re bit) in dma control register. to guarantee the complete dma re-run, users should not change the dma configuration before the re-start. data transfer mode single step mode the single step mode is usually used for test or debugging because the bus mastership can be handed over to other bus master between read and write. for the initiation of dma operation, we need the activation of ndreq for each read and write cycle and there should be separate activation of ndack for each read and write cycle. in other word, we need two times dma request and two times dma acknowledge for single dma operation. for this reason, this kind of dma operation is too slow and this is only for debugging purpose. during the inactive period of nxdack, i.e., between read and write cycle, the bus controller re-evaluates the bus priority to determine the new bus mastership. when the dma request signal goes low, the bus controller can indicate the bus allocation for the dma operation by lowering the dma acknowledge signal if there is not higher priority bus request except this dma request. during the first low level period of the dma acknowledge signal, there will be a dma read cycle. after the dma read cycle, there will be a rising of the dma acknowledge signal to indicate the end of the dma read cycle. simultaneously, the next dma write cycle will happen if the dma request signal is still low at the rising edge of dma acknowledge. but, if the dma request signal is already high at the rising edge of dma acknowledge, the next dma write cycle will be delayed to the new coming activation of dma request signal. the single step mode of dma operation can be initiated by the request from uart or sio or timer1/3 as well as ndreq. ndreq ndack rd/wr cycle figure 6-2. external dma requests (single mode)
dma S3C3410X risc m icroprocessor 6- 4 block transfer mode the block transfer mode means that the dma operation will be continued up to the end of transfer count. usually, the dma needs the request signal during the unit-by-unit transfer. the block transfer mode need just one time request for whole service of dma operation, which is shown in figure 6-3. this transfer mode can monopoly the bus usage if users set the cm(continuous mode) bit in dma control register and it can be harmful for other bus mastership. therefore, users should be aware of the worst case situation when they need this mode for faster data transfer. if users take the block transfer mode without setting the cm bit, there will be no bus monopoly. it means that the higher bus master can take the bus usage during the block transfer. ndreq ndack rd/wr cycle figure 6-3. external dma requests (block mode)
S3C3410X risc microprocessor dma 6- 5 demand mode the demand mode means there will be continuous dma transfer cycles as long as the activation of dma request signal as shown in figure 6-4. this mode doesn't permit the bus hand-over even though the higher priority bus master request the bus mastership to bus controller during dma operations. in other word, no other bus master can have the bus mastership during the demand mode. due to the monopoly of bus mastership in demand mode, we should be aware of the fact that the duration of the demand mode must not exceed the specified maximum time such as the dram refresh period. ndreq ndack rd/wr cycle figure 6-4. external dma requests (demand mode)
dma S3C3410X risc m icroprocessor 6- 6 dma special function register dma control registers register offset address r/w description reset value dmacon0 0x300c r/w dma 0 control register 0x0 dmacon1 0x400c r/w dma 1 control register 0x0 dmaconx bit description initial state re [0] run enable: this bit determines the enable or disable of dma operation. to start the dma operation, this bit should be set. to stop the dma operation, users can reset this bit. 0 = disable 1 = enable 0 bs [1] busy status: when the dma start its operation, this read-only status bit is set to "1" automatically. when the dma is in an idle state, this bit is set to "0". this bit is "read-only". 0 mode [3:2] mode select: these bits determine the source of dma initiation. the initiation of dma operation can be done by s/w, external ndreq, uart, or sio/timer. dmacon0 dmacon1 00 = software 00 = software 01 = external ndreq0 01 = external ndreq1 10 = uart 10 = uart 11 = sio, timer 11 = sio, timer 00 dd [4] destination address direction: this bit determines whether the destination address will be decreased or increased during a dma operation 0 = increase address 1 = decrease address 0 sd [5] source address direction: this bit determines whether the source address will be decreased or increased during a dma operation 0 = increase address 1 = decrease address 0 df [6] destination address fix: this bit determines whether the destination address should be changed during a dma operation, or not. if users take df option, the destination address will be fixed. 0 = increase/decrease destination address 1 = do not change destination address (fix) 0
S3C3410X risc microprocessor dma 6- 7 dmaconx bit description initial state sf [7] source address fix: this bit determines whether the source address should be changed during a dma operation, or not. if users take sf option, the source address will be fixed. 0 = increase/decrease source address 1 = do not change source address (fix) 0 si [8] stop interrupt enable: the dma operation can be started by setting re bit to "1" and can also be stopped by resetting re bit to "0". when this si bit is set to "1", and when the dma operation is forced to stop, there will be "stop interrupt" generation. if this bit is "0", the "stop interrupt" will not be generated. the dma done interrupt, which is generated after the dma counter is expired, can not be masked by this bit. 0 = do not generate the stop interrupt when dma stops 1 = generate the stop interrupt when dma stops 0 bt (note) [9] 4 burst enable: when the mode bit is set to "1" , the dma operation will be done by the burst transfer mode. the size of burst will depend on tw field in this register. if tw is word unit, there will be four times word transfer. 0 = normal transfer 1 = 4 burst transfer 0 reserved [10] reserved 0 sb [11] single/block mode: this bit determines the number of external dma request (ndreq) that are required for the dma operation. 0 = one ndreq initiates a single dma operation 1 = one ndreq initiates a block dma operation 0 tw [13:12] transfer width: this bit determines the transfer data width: byte(8-bit), half-word(16-bit) and word(32-bit). if the transfer width is a byte, source/destination address will be increased/decreased by one(byte address unit), if it is a half- word, the address will be increased/decreased by two(half-word address unit). if it is a word, the address will be increased/decreased by four(word address unit). note that the "transfer width" is not the physical size of data bus. the physical size of data bus is determined by smr(system manager register) configuration. 00 = byte(8-bit) 01 = half-word(16-bit) 10 = word(32-bit) 11 = not used 00
S3C3410X risc microprocessor dma 6- 8 dmaconx bit description initial state cm [14] continuous mode: this bit determines whether the dma operation should monopoly the system bus, or not until the transfer count value reaches to zero. 0 = normal operation 1 = monopoly the system bus until the completion of dma operation. 0 dm [15] demand mode: to speed up the external dma operation, set this bit. if this bit is set, the dma operation will be continuously proceeded while ndreq is activated. in this case, other higher bus master can not take the bus usage while the operation of this demand mode. 0 = normal external dma mode 1 = demand mode 0 note: if a dma is set as four data burst and continuous mode together, four burst mode is ignored, and the continuous mode only is operated. in order to use four burst mode in dma operation, please be sure that continuous mode is disabled.
S3C3410X risc microprocessor dma 6- 9 dma source/destination address register these registers contain the 27-bit source/destination address of a dma channel. depending on the setting of the dma control register (dmaconx), these addresses will be increased/decreased or will be fixed without changing. register offset address r/w description reset value dmasrc0 0x3000 r/w dma 0 source address register 0x0 dmadst0 0x3004 r/w dma 0 destination address register 0x0 dmasrc1 0x4000 r/w dma 1 source address register 0x0 dmadst1 0x4004 r/w dma 1 destination address register 0x0 dmasrc0 bit description initial state [26:0] initial source address for dma0 0x0 dmasrc1 bit description initial state [26:0] initial source address for dma1 0x0 dmadst0 bit description initial state [26:0] initial destination address for dma0 0x0 dmadst1 bit description initial state [26:0] initial destination address for dma1 0x0 dma transfer count register these registers contain the 26-bit count value which is the number of dma transfer. this value is decreased by 1 when one dma operation is completed regardless of the width of the data which should be transferred. if the dma operates 4 burst mode, the dmacnt is decreased by 1 when 4 data transfer is completed register offset address r/w description reset value dmacnt0 0x3008 r/w dma transfer count register for dma0 0x0 dmacnt1 0x4008 r/w dma transfer count register for dma1 0x0 dmacnt0,1 bit description initial state [26:0] number of dma transfer 0x0
dma S3C3410X risc m icroprocessor 6- 10 notes
S3C3410X risc microprocessor i/o ports 7- 1 7 i/o ports overview S3C3410X has 74 multiplexed input/output port pins. there are ten port group, which are eight 8-bit i/o port group, one 2-bit output port group, and one 8-bit input port group: eight 8-bit input/output ports (port 0, 1, 2, 3, 4, 5, 6 and 7) one 2-bit output ports (port 9) one 8-bit input ports (ain0 ? ain7 / p8.0 ? p8.7, port 8) each port can be easily configured by software to meet the various system configuration and design requirement. users should define the functionality of port before the start of main program. if users does not want to use the multiplexed pin functionality pin, these pin can be configured as simple i/o port. for example, the port 8 can be used as analog input for adc module or as general input port pins.
i/o ports S3C3410X risc microprocessor 7- 2 table 7-1. S3C3410X port configuration overview port configuration options recommend 0 general i/o port with pull-up resistor: p0.0, p0.1, p0.2, p0.3 and p0.4 can alternately serve as external capture input or clock input for timer0, 1, 2, 3 and 4 respectively. p0.5 and p0.6 can alternately serve as pwm or toggle out for a timer3 and 4 respectively. p0.7 can be used as external interrupt input eint0 or external port write strobe signal(nwrexp). bit programmable 1 general i/o port: p1.4 ? p1.7 can alternately serve as external interrupt inputs of eint4 ? eint7, or can be configured as address line of a20 ? a23 for external interface. p1.0 ? p1.3 can alternately as address line of a16 ? a19 for external interface. bit programmable 2 general i/o port: p2.0 ? p2.6 can be used alternately as chip select signal lines for the external interface. p2.7 can be used as external interrupt input eint1 or chip select strobes for the extra device(necs0). bit programmable 3 general i/o port: p3.0 ? p3.6 can be used alternately as bus control signal lines for the external interface: nwbe0:nbe0:dqm0, nwbe1:nbe1:dqm1, ncas0:nsras, ncas1:nscas, scke, sclk. p3.7 can be used alternately as external interrupt input eint2 or chip select strobes for the extra device(necs1). bit programmable 4 general i/o port: p4.0 ? p4.7 can be configured as data lines, d8 ? d15 for the external interface or address line, a16 ? a23. bit programmable 5 general i/o port: p5.0 and p5.2 can be used alternately as external request input for dma module: ndreq0, ndreq1. p5.1 and p5.3 can be used alternately as external acknowledge output for dma module: ndack0, ndack1. p5.4 and p5.5 can be used alternately as serial data and serial clock for iic module: iicsda and iicsck. p5.6 and p5.7 can be used alternately as input and output for uart module: urxd and utxd. bit programmable 6 general i/o port: p6.0 and p6.4 can be used alternately as serial data input pins for sio module: siorxd0 and siorxd1. p6.2 and p6.6 can be used alternately as serial data output pins for sio module: siotxd0 and siotxd1. p6.1 and p6.5 can be used alternately as external clock input/output for sio module: sioclk0 and sioclk1. p6.7 can be used as external interrupt input eint3. bit programmable 7 general i/o port: can be used as a real time output by 8-bit or 4-bit unit. if test[1:0] bit is set to "10" or "11", p0.0 ? p0.4 can be used as jtag test port: ntck (p7.0), tms (p7.1), tdi (p7.2), ntrst (p7.3), tdo (p7.4). bit programmable 8 analog input channels ain0 ? ain7, alternately general input port or external interrupt input eint8(p8.4), eint9(p8.5), eint10(p8.6) and eint11(p8.7). bit programmable 9 general output port: p9.0 and p9.1 can be used alternately as lcd control signal, lp and dclk bit programmable
S3C3410X risc microprocessor i/o ports 7- 3 i/o port control register port data register all ten port data registers have the identical structure as shown in below: table 7-2. port data register summary register name mnemonic offset reset value r/w port 0 data register pdat0 0xb000 0x0 r/w port 1 data register pdat1 0xb001 0x0 r/w port 2 data register pdat2 0xb002 0x0 r/w port 3 data register pdat3 0xb003 0x0 r/w port 4 data register pdat4 0xb004 0x0 r/w port 5 data register pdat5 0xb005 0x0 r/w port 6 data register pdat6 0xb006 0x0 r/w port 7 data register pdat7 0xb007 0x0 r/w port 8 data register pdat8 0xb008 0x0 r port 9 data register pdat9 0xb009 0x0 r/w port 7 buffer register p7br 0xb00b 0x0 r/w pdatn bit description initial state i/o port n data register (n = 0 ? 9, n = 0 ? 7, 9 : r/w, n = 8 : r) : when the port is configured as input port, the port data will reflect the signal on the pin. when the port is configured as output port, the port data in port data register will be given as output on the pin. pn.0 [0] port n.0 port data bit (lsb) 0 pn.1 [1] port n.1 port data bit 0 pn.2 [2] port n.2 port data bit 0 pn.3 [3] port n.3 port data bit 0 pn.4 [4] port n.4 port data bit 0 pn.5 [5] port n.5 port data bit 0 pn.6 [6] port n.6 port data bit 0 pn.7 [7] port n.7 port data bit (msb) 0
i/o ports S3C3410X risc microprocessor 7- 4 table 7-3. port control register summary register name mnemonic offset reset value r/w external interrupt pending register eintpnd 0xb031 0x0 r/w external interrupt control register eintcon 0xb032 0x0 r/w external interrupt mode register eintmod 0xb034 0x0 r/w port 0 control register pcon0 0xb010 0x0 r/w port 1 control register pcon1 0xb012 0x0 r/w port 2 control register pcon2 0xb014 0x0 r/w port 3 control register pcon3 0xb016 0x0 r/w port 4 control register pcon4 0xb018 0x0 r/w port 5 control register pcon5 0xb01c 0x0 r/w port 6 control register pcon6 0xb020 0x0 r/w port 7 control register pcon7 0xb024 0x0 r/w port 8 control register pcon8 0xb026 0x0 r/w port 9 control register pcon9 0xb027 0x0 r/w port 0 pull-up control register pur0 0xb028 0x80 r/w port 1 pull-down control register pdr1 0xb029 0xff r/w port 2 pull-up control register pur2 0xb02a 0xff r/w port 3 pull-up control register pur3 0xb02b 0xff r/w port 4 pull-down control register pdr4 0xb02c 0xff r/w port 5 pull-up control register pur5 0xb02d 0x0 r/w port 6 pull-up control register pur6 0xb02e 0x0 r/w port 7 pull-up control register pur7 0xb02f 0x0 r/w port 8 pull-up control register pur8 0xb03c 0x0 r/w
S3C3410X risc microprocessor i/o ports 7- 5 port 0 control registers (pcon0, pur0) register offset address r/w description reset value pcon0 0xb010 r/w configuration the pins of port 0 0x0 pur0 0xb028 r/w pull-up disable resister for port 0 0x80 pcon0 bit description initial state p0.0 [0] 0 = schmitt input mode, capture (tcap0), or clock (tclk0) input for timer 0. if the timer mode is configured as capture mode or external timer clock mode, this pin will be used as tcap0 or tclk0. if the timer is disabled or use the internal clock as timer input clock, this pin will be configured as input port. 1 = c-mos push-pull output 0 p0.1 [1] 0 = schmitt input mode, capture (tcap1), or clock (tclk1) input for timer 1. if the timer mode is configured as capture mode or external timer clock mode, this pin will be used as tcap1 or tclk1. if the timer is disabled or use the internal clock as timer input clock, this pin will be configured as input port. 1 = c-mos push-pull output 0 p0.2 [2] 0 = schmitt input mode, capture (tcap2), or clock (tclk2) input for timer 2. if the timer mode is configured as capture mode or external timer clock mode, this pin will be used as tcap2 or tclk2. if the timer is disabled or use the internal clock as timer input clock, this pin will be configured as input port. 1 = c-mos push-pull output 0 p0.3 [3] 0 = schmitt input mode or clock (tclk3) input for timer 3. if the timer mode is configured as external timer clock mode, this pin will be used as tclk3. if the timer is disabled or use the internal clock as timer input clock, this pin will be configured as input port. 1 = c-mos push-pull output 0 p0.4 [4] 0 = schmitt input mode or clock (tclk4) input for timer 4. if the timer mode is configured as external timer clock mode, this pin will be used as tclk4. if the timer is disabled or use the internal clock as timer input clock, this pin will be configured as input port. 1 = c-mos push-pull output 0
i/o ports S3C3410X risc microprocessor 7- 6 pcon0 bit description initial state p0.5 [6:5] 00 = schmitt input mode or capture (tcap3) input for timer 3. if the timer mode is configured as capture mode, this pin will be used as tcap3. 01 = c-mos push-pull output 10 = c-mos push-pull pwm0/tout3 output for timer 3 00 p0.6 [8:7] 00 = schmitt input mode or capture (tcap4) input for timer 4. if the timer mode is configured as capture mode, this pin will be used as tcap4. 01 = c-mos push-pull output 10 = c-mos push-pull pwm1/tout4 output for timer 4 00 p0.7 [10:9] 00 = schmitt input mode or external interrupt input (eint0). if the eint0 is enabled, this pin will be used as external interrupt request pin. otherwise, this pin will be used as input port pin. 01 = c-mos push-pull output 10 = c-mos push-pull nwrexp output 00 pur0 bit description initial state p0 [7:0] setting the corresponding pull-up resistor of port 0 0 = disable pull-up resister 1 = enable pull-up resister 0x80
S3C3410X risc microprocessor i/o ports 7- 7 v dd pull-up resistor (typical value: 50 k w ) v dd pull-up enable alternative signal port data m u x select output enable in/out data normal input alternative input v ss figure 7-1. pin circuit type 0 (p0.0 ? p0.6) v dd pull-up resistor (typical value: 50 k w ) v dd pull-up enable alternative signal port data m u x select output enable in/out data external interrupt input noise filter v ss normal input figure 7-2. pin circuit type 0-1 (p0.7, p2.7, p3.7, p6.7)
i/o ports S3C3410X risc microprocessor 7- 8 port 1 control registers (pcon1, pdr1) register offset address r/w description reset value pcon1 0xb012 r/w configuration the pins of port 1 0x0 pdr1 0xb029 r/w pull-down disable resister for port 1 0xff pcon1 bit description initial state p1.0 [0] setting the corresponding bit of port 1 0 = schmitt input mode 1 = c-mos push-pull output mode 0 p1.1 [1] setting the corresponding bit of port 1 0 = schmitt input mode 1 = c-mos push-pull output mode 0 p1.2 [2] setting the corresponding bit of port 1 0 = schmitt input mode 1 = c-mos push-pull output mode 0 p1.3 [3] setting the corresponding bit of port 1 0 = schmitt input mode 1 = c-mos push-pull output mode 0 p1.4 [4] setting the corresponding bit of port 1 0 = input or external interrupt input(eint4). if the eint4 is enabled, this pin will be used as external interrupt request pin. otherwise, this pin will be used as input port pin. 1 = c-mos push-pull output mode 0 p1.5 [5] setting the corresponding bit of port 1 0 = input or external interrupt input(eint5). if the eint5 is enabled, this pin will be used as external interrupt request pin. otherwise, this pin will be used as input port pin. 1 = c-mos push-pull output mode 0 p1.6 [6] setting the corresponding bit of port 1 0 = input or external interrupt input(eint6). if the eint6 is enabled, this pin will be used as external interrupt request pin. otherwise, this pin will be used as input port pin. 1 = c-mos push-pull output mode 0 p1.7 [7] setting the corresponding bit of port 1 0 = input or external interrupt input(eint7). if the eint7 is enabled, this pin will be used as external interrupt request pin. otherwise, this pin will be used as input port pin. 1 = c-mos push-pull output mode 0 mp1 [15:8] setting the port 1 mode 0 = normal input/output mode (p1.0 ? p1.7 sets the its corresponding bit of port 1) 1 = address bus line mode (don't care of value p1.0 ? p1.7). if this bit is 1, p1.0?p1.7 will be used as address of a16 ? a23. 0x00 pdr1 bit description initial state p1 [7:0] setting the corresponding pull-down resistor of port 1 0 = disable pull-down resister 1 = enable pull-down resister 0xff
S3C3410X risc microprocessor i/o ports 7- 9 v dd pull-down resistor (typical value: 50 k w ) v ss pull-down enable alternative signal port data m u x select output enable in/out data normal input alternative input v ss figure 7-3. pin circuit type 1-1 (port1.0 ? port1.3) v dd pull-down resistor (typical value: 50 k w ) v ss pull-down enable alternative signal port data m u x select output enable in/out data external interrupt input noise filter v ss normal input figure 7-4. pin circuit type 1-2 (port1.4 ? port1.7)
i/o ports S3C3410X risc microprocessor 7- 10 port 2 control registers (pcon2, pur2) register offset address r/w description reset value pcon2 0xb014 r/w configuration the pins of port 2 0x0 pur2 0xb02a r/w pull-up disable resister for port 2 0xff pcon2 bit description initial state p2.0 [1:0] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = chip select signal(ncs1) output for the external interface 00 p2.1 [3:2] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = chip select signal(ncs2) output for the external interface 00 p2.2 [5:4] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = chip select signal(ncs3) output for the external interface 00 p2.3 [7:6] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = chip select signal(ncs4) output for the external interface 00 p2.4 [9:8] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = chip select signal(ncs5) output for the external interface 00 p2.5 [11:10] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = chip select signal(ncs6) or row address strobe signal(nras0) for dram or chip select signal(nscs0) for sdram. it depends on the configuration on bank 6. if this bank is configured as rom/sram, edo dram, or sdram, this signal will behavior as ncs6, nras0, or nscs0. 00 p2.6 [13:12] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = chip select signal(ncs7) or row address strobe signal(nras1) for dram or chip select signal(nscs1) for sdram. it depends on the configuration on bank 7. if this bank is configured as rom/sram, edo dram, or sdram, this signal will behavior as ncs7, nras0, or nscs0. 00 p2.7 [15:14] 00 = input or external interrupt input(eint1) 01 = c-mos push-pull output mode 10 = extra chip select signal(necs0) output for the external interface 00 pur2 bit description initial state p2 [7:0] setting the corresponding pull-up resistor of port 2 0 = disable pull-up resister 1 = enable pull-up resister 0xff
S3C3410X risc microprocessor i/o ports 7- 11 v dd pull-up resistor (typical value: 50 k w ) v dd pull-up enable alternative signal port data m u x select output enable in/out data normal input v ss figure 7-5. pin circuit type 2-1 (p2.0 ? p2.6)
i/o ports S3C3410X risc microprocessor 7- 12 port 3 control registers (pcon3, pur3) register offset address r/w description reset value pcon3 0xb016 r/w configuration the pins of port 3 0x0 pur3 0xb02b r/w pull-up disable resister for port 3 0xff pcon3 bit description initial state p3.0 [1:0] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = write byte enable(nwbe0) output for external interface or data mask(dqm0) output for sdram or byte enable(nbe0) output for x16 sram. if the memory bank is configured as sdram bank, this port will behavior as data mask(dqm0). if the memory bank is configured as x16 sram bank, this port will behavior as byte enable(nbe0). otherwise, this port will behavior as nwbe0. 00 p3.1 [3:2] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = write byte enable(nwbe1) output for external interface or data mask(dqm1) output for sdram or byte enable(nbe0) output for x16 sram. if the memory bank is configured as sdram bank, this port will behavior as data mask(dqm1). if the memory bank is configured as x16 sram bank, this port will behavior as byte enable(nbe0). otherwise, this port will behavior as nwbe1. 00 p3.2 [5:4] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = column address strobe(ncas0) output for dram or row address strobe(nsras) output for sdram. if the memory bank is configured as edo dram. this port will behavior as ncas0. if the memory bank is configured as sdram bank, this port will behavior as nsras. 00 p3.3 [7:6] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = column address strobe(ncas1) output for dram or row address strobe(nscas) output for sdram. this port will behavior as ncas1. if the memory bank is configured as sdram bank, this port will behavior as nsras. 00 p3.4 [9:8] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = write enable(nwe) output for 16-bit sram or sdram 00 p3.5 [11:10] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = clock enable(scke) output for sdram 00 p3.6 [13:12] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = clock output for sdram 00 p3.7 [15:14] 00 = c-mos input mode or external interrupt(eint2) mode 01 = c-mos push-pull output mode 10 = extra chip select(necs1) output 00
S3C3410X risc microprocessor i/o ports 7- 13 pur3 bit description initial state p3 [7:0] setting the corresponding pull-up resistor of port 3 0 = disable pull-up resister 1 = enable pull-up resister 0xff v dd pull-up resistor (typical value: 50 k w ) v dd pull-up enable alternative signal port data m u x select output enable in/out data normal input v ss figure 7-6. pin circuit type 3-1 (p3.0 ? p3.6)
i/o ports S3C3410X risc microprocessor 7- 14 port 4 control registers (pcon4, pdr4) register offset address r/w description reset value pcon4 0xb018 r/w configuration the pins of port 4 0x0 pdr4 0xb02c r/w pull-down disable resister for port 4 0xff pcon4 bit description initial state p4.0 [1:0] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = a16 11 = d8 00 p4.1 [3:2] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = a17 11 = d9 00 p4.2 [5:4] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = a18 11 = d10 00 p4.3 [7:6] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = a19 11 = d11 00 p4.4 [9:8] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = a20 11 = d12 00 p4.5 [11:10] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = a21 11 = d13 00 p4.6 [13:12] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = a22 11 = d14 00 p4.7 [15:14] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = a23 11 = d15 00 pdr4 bit description initial state p4 [7:0] setting the corresponding pull-down resistor of port 4 0 = disable pull-down resister 1 = enable pull-down resister 0xff
S3C3410X risc microprocessor i/o ports 7- 15 v dd pull-down resistor (typical value: 50 k w ) v ss pull-down enable alternative signal port data m u x select output enable in/out data normal input alternative input v ss figure 7-7. pin circuit type 4 (port 4)
i/o ports S3C3410X risc microprocessor 7- 16 port 5 control registers (pcon5, pur5) register offset address r/w description reset value pcon5 0xb01c r/w configuration the pins of port 5 0x0 pur5 0xb02d r/w pull-up disable resister for port 5 0x0 pcon5 bit description initial state p5.0 [1:0] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = external dma request input (ndreq0) 00 p5.1 [3:2] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = external dma acknowledge output (ndack0) 00 p5.2 [5:4] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = external dma request input (ndreq1) 00 p5.3 [7:6] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = external dma acknowledge output (ndack1) 00 p5.4 [9:8] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = serial data line, sda for iic interface (open-drain type) 00 p5.5 [11:10] 00 = c-mos input mode 01 = c-mos push-pull output mode 10 = serial clock line, sck for iic interface (open-drain type) 00 p5.6 [13:12] 00 = schmitt input mode or serial input(urxd) for uart. for the case of urxd, the uart should be enabled. otherwise, this bit will be input port. 01 = c-mos push-pull output mode 10 = n-ch open-drain output mode 00 p5.7 [16:14] 000 = schmitt input mode 001 = c-mos push-pull output mode 011 = n-ch open-drain output mode 101 = c-mos push-pull serial output(utxd) for uart 111 = n-ch open-drain serial output(utxd) for uart 000 pur5 bit description initial state p5 [7:0] setting the corresponding pull-up resistor of port 5 0 = disable pull-up resister 1 = enable pull-up resister 0x0
S3C3410X risc microprocessor i/o ports 7- 17 v dd alternative signal port data m u x select output enable in/out data normal input alternative input v ss pull-up resistor (typical value: 50 k w ) v dd pull-up enable figure 7-8. pin circuit type 5-1 (p5.0 ? p5.5) v dd pull-up resistor (typical value: 50 k w ) v dd pull-up enable alternative signal port data m u x select output enable in/out data normal input alternative input v ss open-drain figure 7-9. pin circuit type 5-9 (p5.6, p5.7, p6.0 ? p6.6)
i/o ports S3C3410X risc microprocessor 7- 18 port 6 control registers (pcon6, pur6) register offset address r/w description reset value pcon6 0xb020 r/w configuration the pins of port 6 0x0 pur6 0xb02e r/w pull-up disable resister for port 6 0x0 pcon6 bit description initial state p6.0 [1:0] 00 = schmitt input or serial data input(siorxd0) mode for sio. for the case of siorxd0, the sio 0 should be enabled. otherwise, this bit will be input port. 01 = c-mos push-pull output mode 10 = n-ch open-drain output mode 00 p6.1 [4:2] 000 = schmitt input or serial clock input(sioclk0) mode for sio for the case of sioclk0, the sio 0 should be enabled. otherwise, this bit will be input port. 001 = c-mos push-pull output mode 010 = n-ch open-drain output mode 101 = c-mos push-pull serial clock output (sioclk0) for sio 0 110 = n-ch open-drain serial clock output (sioclk0) for sio 0 000 p6.2 [7:5] 000 = schmitt input mode 001 = c-mos push-pull output mode 010 = n-ch open-drain output mode 101 = c-mos push-pull serial data output (siotxd0) for sio 0 110 = n-ch open-drain serial data output (siotxd0) for sio 0 000 p6.3 [9:8] 00 = schmitt input mode 01 = c-mos push-pull output mode 10 = wait signal(nwait) input for the external interface 11 = ready signal(nsiordy) input or output for sio0,1 00 p6.4 [11:10] 00 = schmitt input or serial data input (siorxd1) mode for sio. for the case of siorxd1, the sio 1 should be enabled. otherwise, this bit will be input port. 01 = c-mos push-pull output mode 10 = n-ch open-drain output mode 00 p6.5 [14:12] 000 = schmitt input or serial clock input (sioclk1) mode for sio for the case of sioclk1, the sio 1 should be enabled. otherwise, this bit will be input port. 001 = c-mos push-pull output mode 010 = n-ch open-drain output mode 101 = c-mos push-pull serial clock output (sioclk1) for sio 1 110 = n-ch open-drain serial clock output(sioclk1) for sio 1 000 p6.6 [17:15] 000 = schmitt input mode 001 = c-mos push-pull output mode 010 = n-ch open-drain output mode 101 = c-mos push-pull serial data output (siotxd1) for sio 1 110 = n-ch open-drain serial data output (siotxd1) for sio 1 000 p6.7 [18] 0 = schmitt input mode or external interrupt (eint3) input mode. for the case of eint3, the eint3 should be enabled. otherwise, this bit will be input port. 1 = c-mos push-pull output mode 0
S3C3410X risc microprocessor i/o ports 7- 19 pur6 bit description initial state p6 [7:0] setting the corresponding pull-up resistor of port 6 0 = disable pull-up resister 1 = enable pull-up resister 0x0 port 7 control registers (pcon7, pur7) register offset address r/w description reset value pcon7 0xb024 r/w configuration the pins of port 7 0x0 pur7 0xb02f r/w pull-up disable resister for port 7 0x0 p7br 0xb00b r/w buffer register for storing real time output data 0x0 pcon7 bit description initial state p7.0 (rp0) [0] 0 = c-mos input mode 1 = c-mos push-pull output mode 0 p7.1 (rp1) [1] 0 = c-mos input mode 1 = c-mos push-pull output mode 0 p7.2 (rp2) [2] 0 = c-mos input mode 1 = c-mos push-pull output mode 0 p7.3 (rp3) [3] 0 = c-mos input mode 1 = c-mos push-pull output mode 0 p7.4 (rp4) [4] 0 = c-mos input mode 1 = c-mos push-pull output mode 0 p7.5 (rp5) [5] 0 = c-mos input mode 1 = c-mos push-pull output mode 0 p7.6 (rp6) [6] 0 = c-mos input mode 1 = c-mos push-pull output mode 0 p7.7 (rp7) [7] 0 = c-mos input mode 1 = c-mos push-pull output mode 0 rto [9:8] setting port 7 as real time output 00 = general i/o port 01 = low nibble real time output buffer mode 10 = high nibble real time output buffer mode 11 = byte real time output buffer mode 00 lns [10] time source of low nibble real time output 0 = t0 1 = t3 0 hns [11] time source of high nibble real time output 0 = t0 1 = t3 0 pur7 bit description initial state p7 [7:0] setting the corresponding pull-up resistor of port 7 0 = disable pull-up resister 1 = enable pull-up resister 0x0 note: port 7 can be used for the realtime buffer output port. the realtime buffer is that p7br data are output to rp[7:0], when timerd or timer3 match interrupt occurs. at this time, p7 must be configured to c-mos push-pull output mode.
i/o ports S3C3410X risc microprocessor 7- 20 v dd pull-up resistor (typical value: 50 k w ) v dd pull-up enable alternative signal port data m u x select output enable in/out data normal input v ss figure 7-10. pin circuit type 7 (p7.0 ? p7.7) m u x 4 4 p7b0 (high) t0/t3 int data bus (bit4-7) 4 p7 (high) 4 rp4-rp7 m u x 4 4 p7b0 (low) t0/t3 int data bus (bit0-3) 4 p7 (low) 4 rp0-rp3 pcon7 figure 7-11. port 7 (real time output)
S3C3410X risc microprocessor i/o ports 7- 21 tdat0 = #f p7br = #1100b tdat0 = #a start timer 0 p7br = #0000b #0000b tdat0 = #4 p7br = #1101b #1100b tdat0 = #6 p7br = #1011b #1101b tdat0 = #7 p7br = #0111b #1011b a f 4 6 #1110b tdat0 = #4 p7br = #1100b #1100b 7 8 4 tdat0 = #n p7br = #nb #1110b 5 tdat0 = #8 p7br = #1110b tdat0 = #5 p7br = #1110b #0111b timer0 interrupt figure 7-12. real time output example
i/o ports S3C3410X risc microprocessor 7- 22 port 8 control registers (pcon8, pur8) register offset address r/w description reset value pcon8 0xb026 r/w configuration the pins of port 8 0x0 pur8 0xb03c r/w pull-up disable resister for port 8 0x0 pcon8 bit description initial state p8.0 [0] 0 = c-mos input mode 1 = ain0 0 p8.1 [1] 0 = c-mos input mode 1 = ain1 0 p8.2 [2] 0 = c-mos input mode 1 = ain2 0 p8.3 [3] 0 = c-mos input mode 1 = ain3 0 p8.4 [4] 0 = c-mos input mode or external interrupt input mode. for the case of eint8, the eint8 should be enabled. otherwise, this bit will be input port. 1 = ain4 0 p8.5 [5] 0 = c-mos input mode or external interrupt input mode. for the case of eint9, the eint9 should be enabled. otherwise, this bit will be input port. 1 = ain5 0 p8.6 [6] 0 = c-mos input mode or external interrupt input mode. for the case of eint10, the eint10 should be enabled. otherwise, this bit will be input port. 1 = ain6 0 p8.7 [7] 0 = c-mos input mode or external interrupt input mode. for the case of eint11, the eint11 should be enabled. otherwise, this bit will be input port. 1 = ain7 0 pur8 bit description initial state p8 [7:0] setting the corresponding pull-up resistor of port 7 0 = disable pull-up resister 1 = enable pull-up resister 0x0
S3C3410X risc microprocessor i/o ports 7- 23 pull-up resistor (typical value: 50 k w ) v dd pull-up resistor enable in + - avref normal input mode normal input adc input figure 7-13. pin circuit type 8-1 (p8.0 ? p8.3) pull-up resistor (typical value: 50 k w ) v dd interrupt input noise filter normal input pull-up resistor enable normal input mode in + - avref adc input figure 7-14. pin circuit type 8-2 (p8.4 ? p8.7)
i/o ports S3C3410X risc microprocessor 7- 24 port 9 control registers (pcon9) register offset address r/w description reset value pcon9 0xb027 r/w configuration the pins of port 9 0x0 pcon8 bit description initial state p9.0 [0] 0 = lcd clock output mode (for lp) 1 = c-mos push-pull output lp: when you write any data to extdat0 or extdat1 register, this signal is generated by the memory controller. 0 p9.1 [1] 0 = lcd line pulse output mode (for dclk) 1 = c-mos push-pull output dclk: when you write any data to extport register by dma, this signal is generated by the memory controller. 0 v dd in/out alternative signal port data m u x select v ss figure 7-15. pin circuit type 9 (p9.0, p9.1)
S3C3410X risc microprocessor i/o ports 7- 25 v dd ncs0 nrd nas v ss figure 7-16. pin circuit type 10 (ncs0, nrd and nas) reset v dd pull-up resistor (typical 100 k w ) figure 7-17. pin circuit type 11 ( reset reset ) test1 test2 mode selection figure 7-18. pin circuit type 12 (test1, test2)
i/o ports S3C3410X risc microprocessor 7- 26 external interrupt control registers (eintpnd, eintcon, eintmod) register offset address r/w description reset value eintpnd 0xb031 r/w external interrupt pending register 0x0 eintcon 0xb032 r/w external interrupt control register 0x0 eintmod 0xb034 r/w external interrupt mode register 0x0 eintpnd bit description initial state eint4 [0] 0 = no interrupt pending 0 = clear interrupt pending condition (when write) 1 = external interrupt(eint4) is pending 0 eint5 [1] 0 = no interrupt pending 0 = clear interrupt pending condition (when write) 1 = external interrupt(eint5) is pending 0 eint6 [2] 0 = no interrupt pending 0 = clear interrupt pending condition (when write) 1 = external interrupt(eint6) is pending 0 eint7 [3] 0 = no interrupt pending 0 = clear interrupt pending condition (when write) 1 = external interrupt(eint7) is pending 0
S3C3410X risc microprocessor i/o ports 7- 27 eintcon bit description initial state eint0 [0] setting external interrupt enable of eint0 0 = disable external interrupt 1 = enable external interrupt 0 eint1 [1] setting external interrupt enable of eint1 0 = disable external interrupt 1 = enable external interrupt 0 eint2 [2] setting external interrupt enable of eint2 0 = disable external interrupt 1 = enable external interrupt 0 eint3 [3] setting external interrupt enable of eint3 0 = disable external interrupt 1 = enable external interrupt 0 eint4 [4] setting external interrupt enable of eint4 0 = disable external interrupt 1 = enable external interrupt 0 eint5 [5] setting external interrupt enable of eint5 0 = disable external interrupt 1 = enable external interrupt 0 eint6 [6] setting external interrupt enable of eint6 0 = disable external interrupt 1 = enable external interrupt 0 eint7 [7] setting external interrupt enable of eint7 0 = disable external interrupt 1 = enable external interrupt 0 eint8 [8] setting external interrupt enable of eint8 0 = disable external interrupt 1 = enable external interrupt 0 eint9 [9] setting external interrupt enable of eint9 0 = disable external interrupt 1 = enable external interrupt 0 eint10 [10] setting external interrupt enable of eint10 0 = disable external interrupt 1 = enable external interrupt 0 eint11 [11] setting external interrupt enable of eint11 0 = disable external interrupt 1 = enable external interrupt 0
S3C3410X risc microprocessor i/o ports 7- 28 eintmod bit description initial state eint0 [2:0] 000 = falling edge triggered 001 = rising edge triggered 010 = high level interrupt 011 = low level interrupt 100 = both edge triggered 000 eint1 [5:3] 000 = falling edge triggered 001 = rising edge triggered 010 = high level interrupt 011 = low level interrupt 100 = both edge triggered 000 eint2 [8:6] 000 = falling edge triggered 001 = rising edge triggered 010 = high level interrupt 011 = low level interrupt 100 = both edge triggered 000 eint3 [11:9] 000 = falling edge triggered 001 = rising edge triggered 010 = high level interrupt 011 = low level interrupt 100 = both edge triggered 000 eint4 [14:12] 000 = falling edge triggered 001 = rising edge triggered 010 = high level interrupt 011 = low level interrupt 100 = both edge triggered 000 eint5 [17:15] 000 = falling edge triggered 001 = rising edge triggered 010 = high level interrupt 011 = low level interrupt 100 = both edge triggered 000 eint6 [20:18] 000 = falling edge triggered 001 = rising edge triggered 010 = high level interrupt 011 = low level interrupt 100 = both edge triggered 000 eint7 [23:21] 000 = falling edge triggered 001 = rising edge triggered 010 = high level interrupt 011 = low level interrupt 100 = both edge triggered 000 eint8 [25:24] 00 = falling edge triggered 01 = rising edge triggered 10 = high level interrupt 11 = low level interrupt 00 eint9 [27:26] 00 = falling edge triggered 01 = rising edge triggered 10 = high level interrupt 11 = low level interrupt 00 eint10 [29:28] 00 = falling edge triggered 01 = rising edge triggered 10 = high level interrupt 11 = low level interrupt 00 eint11 [31:30] 00 = falling edge triggered 01 = rising edge triggered 10 = high level interrupt 11 = low level interrupt 00 notes: 1. because each external interrupt pins has a 200ns noise filter 2. because eintpndx bits are not cleared automatically, you have to clear this bit by writing "0". (although these bits are not cleared, the interrupt triggering will operate.)
S3C3410X risc microprocessor timer 8- 1 8 timer (16-bit timers & 8-bit timers) overview the S3C3410X has three 16-bit timers (timer0, timer1, and timer2) and two 8-bit timers (timer3 and timer4). the 16-bit timer can operate in interval mode, capture mode, match & overflow mode or dma mode (timer1 only). the 8-bit timer can operate in interval mode, capture mode, pwm (pulse width modulation) mode or dma mode (timer3 only). the clock source for timer can be an internal or an external clock. users can enable or disable the timer by setting control bits in the corresponding timer mode register. the following list summarizes the main features of the general-purpose timers: maximum period of 16-bit timer is 419.4ms at 40mhz and minimum resolution is 25ns at 40mhz maximum period of 8-bit timer is 26.2ms at 40mhz and minimum resolution is 50ns at 40mhz programmable clock source for timer, including an external clock input capture capability with programmable trigger edge on input pin pwm mode operation (timer3 and timer4 only) dma mode operation (timer1 and timer3 only)
timer S3C3410X risc microprocessor 8- 2 8-bit prescaler 16-bit up counter 16-bit comparator timer buffer register timer data register capture detect tclk mclk tcap tofint tmint/ tcapint data bus data bus input select mode select figure 8-1. 16-bit timer block diagram
S3C3410X risc microprocessor timer 8- 3 8-bit prescaler 8-bit up counter 8-bit comparator timer buffer register timer fifo register capture detect tclk tcap tofint tmint/tcapint pwm/tout data bus data bus mode select 1/2 mclk 1/4 mclk 1/8 mclk 1/16 mclk input select input select figure 8-2. 8-bit timer block diagram
timer S3C3410X risc microprocessor 8- 4 operation description 16-bit timers (timer0, timer1 and timer2) interval mode operation in interval mode, a match signal should be generated when the counter value is identical to the value written to the timer data register, tdat0, tdat1 and tdat2. the match signal can generate a timer 0, 1, or 2 match interrupt and clear the counter value. when a match condition happens, the timer output(tout0/1/2) will be toggled. capture mode operation in capture mode, the timer can perform the capturing operation, which is that the counter value is transferred into the capture register(timer data register) in synchronization with an external trigger. the external triggering signal for capturing operation is a pre-defined valid edge on the capture input pin. when this valid signal happens, the counter value in process should be moved into the capture register(timer data register). by using the capturing function, users can measure the time difference between external events. if a valid trigger signal on the pin does not happen before the overflow, an overflow interrupt will be generated and the counter value will be counted from 0000h, again. match & overflow mode operation in this mode, a match signal can be generated when the counter value is identical to the value written to the timer data register. however, the match signal does not clear the counter even if it can generate a match interrupt as same as the interval mode. because it does not clear the counter value, the timer can run up to the overflow of counter value and generate an overflow interrupt, also. after the overflow of counter value, the counter value will be counted from 0000h, again. dma mode operation (timer 1 only) users can use the dma to support the timer 1. the dma can transfer the data in memory to the tdat1(timer data register). when the match interrupt happens, the timer 1 can request the dma service to transfer the data into the tdat1 register, again. before the dma-based operation, users should configure the control information on dma, such as tcon1[5:3] to "010", tdat1, destination address, source address, and so on. this kind of dma-based timer operation is very helpful to generate the pre-defined timing event.
S3C3410X risc microprocessor timer 8- 5 8-bit timer (timer3 and timer4) interval mode operation in interval mode, a match signal should be generated when the counter value is identical to the value written to the timer data register, tdat3 and tdat4. the match signal can generate a timer match interrupt and clear the counter value. when a match condition happens, the timer output(tout3/4) will be toggled. capture mode operation in capture mode, the timer can perform the capturing operation, which is that the counter value is transferred into the capture register(timer data register) in synchronization with an external trigger. the external triggering signal for capturing operation is a pre-defined valid edge on the capture input pin. when this valid signal happens, the counter value in process should be moved into the capture register(timer data register). by using the capturing function, users can measure the time difference between external events. if a valid trigger signal on the pin does not happen before the overflow, an overflow interrupt will be generated and the counter value will be counted from 00h, again. pwm mode operation the timer can be used for generating the pwm(pulse width modulation) signal. timer3/4 can support the pwm functionality, which is different from timer0/1/2. in this mode, a match signal should be generated when the counter value is identical to the written to the timer fifo register(timer data register). however, because the match signal dose not clear the counter, it can generate an overflow interrupt when the counter value reaches to the ffh. after the overflow of counter value, the timer will count its value from 00h, again. to generate the pwm signal, the pwm output should be "low" level as long as the counter value is less than or equal( ) to the value specified in timer buffer register and "high" level as long as the counter value is greater than (>) the value specified in timer buffer register. because it is 8-bit pwm timer, the one period is equal to t clk 256. the pre-scale value can define the input clock frequency of timer according to the following equation: timer input clock frequency(t clk ) = mclk / (pre-scale value + 1) : for timer 0, 1 and 2 timer input clock frequency(t clk ) = mclk / (pre-scale value +1) / (divider value) : for timer 3 and 4 pre-scale value = 0 ? 255, divider value = 2, 4, 8, 16 dma mode operation (timer 3 only) users can use the dma to support the timer 1. the dma can transfer the data in memory to the tdat3(timer data register). when the match interrupt happens, the timer 1 can request the dma service to transfer the data into the tdat3 register, again. before the dma-based operation, users should configure the control information on dma, such as tcon3[5:3] to "010", tdat3, destination address, source address, and so on. this kind of dma-based timer operation is very helpful to generate the pre-defined timing event or the sound using pwm.
timer S3C3410X risc microprocessor 8- 6 timer special function register timer control registers register offset address r/w description reset value tcon0 0x9003 r/w timer 0 control register 0x00 tcon1 0x9013 r/w timer 1 control register 0x00 tcon2 0x9023 r/w timer 2 control register 0x00 tcon3 0x9033 r/w timer 3 control register 0x00 tcon4 0x9043 r/w timer 4 control register 0x00 tcon0, 1, 2 bit description initial state reserved [1:0] reserved 00 ics [2] timer input clock selection: this bit can determine the input clock source of timer. 0 = internal clock 1 = external clock 0 oms [5:3] timer operating mode selection: this field can determine the operating mode of timer. 000 = interval mode operation 001 = match & overflow mode operation 010 = match & dma mode operation (timer1 only) 100 = capture on falling edge of tcap0, 1, and 2 101 = capture on rising edge of tcap0, 1, and 2 110 = capture on rising or falling edges of tcap0, 1, and 2 000 cl [6] timer counter clear: this bit can clear the content of timer counter register. 0 = no effect 1 = clearing the counter register 0 ten [7] timer enable: this bit can enable or disable of timer functionality. 0 = disable (stop) 1 = enable (start) 0
S3C3410X risc microprocessor timer 8- 7 tcon3, 4 bit description initial state cd [1:0] clock divider of internal clock source: this field can determine the divider factor of timer clock source. this bit is only effective when users take the timer clock source as internal cpu clock. in other word, this is effective when ics bit is set to "0". 00 = 1/16 01 = 1/8 10 = 1/4 11 = 1/2 00 ics [2] timer input clock selection: this bit can determine the input clock source of timer. 0 = internal clock 1 = external clock 0 oms [5:3] timer operating mode selection: this field can determine the operating mode of timer. 000 = interval mode operation 001 = pwm mode 010 = match & dma mode operation (timer3 only) 100 = capture on falling edge of tcap3, and 4 101 = capture on rising edge of tcap3, and 4 110 = capture on rising or falling edges of tcap3, and 4 000 cl [6] timer counter clear: this bit can clear the content of timer counter register. 0 = no effect 1 = clearing the counter register 0 ten [7] timer enable: this bit can enable or disable of timer functionality. 0 = disable (stop) 1 = enable (start) 0 notes: 1. timer is continuously operated by one time enabling. 2. if fifo is enabled in pwm mode, data is not stored into tdat4. so to store data into tdat4, fifo should be disabled.
timer S3C3410X risc microprocessor 8- 8 timer fifo control registers register offset address r/w description reset value tfcon 0x904f r/w fifo control register of timer 4 0x0 tfcon bit description initial state fen [0] fifo enable: this bit can determine whether or not to use the fifo 0 = fifo disable 1 = fifo enable 0 fcl [1] fifo reset: this bit can clear the content of timer fifo. this bit is automatically cleared after clearing fifo. 0 = normal mode 1 = fifo clearing 0 ftl [3:2] fifo trigger level: this field can determine the trigger level of fifo empty interrupt. 00 = empty 01 = 1 byte 10 = 2 byte 11 = 4 byte 00 fr [5:4] fifo repeat: this field can determine the number of the usage of fifo data. the seven repeat means that each fifo data should be used in timer seven times before taking next data in fifo. 00 = no effect 01 = one repeat 10 = three repeat 11 = seven repeat 00 timer fifo status registers register offset address r/w description reset value tfstat 0x904e r fifo status register of timer 4 0x0 tfstat bit description initial state fc [2:0] fifo count: number of data in timer fifo 000 ff [3] fifo full: this bit is automatically set to "1" whenever timer fifo is full in case of the fifo enable 0 = 0 timer fifo data 4 1 = full 0
S3C3410X risc microprocessor timer 8- 9 timer prescaler registers register offset address r/w description reset value tpre0 0x9002 r/w timer 0 pre-scale register 0xff tpre1 0x9012 r/w timer 1 pre-scale register 0xff tpre2 0x9022 r/w timer 2 pre-scale register 0xff tpre3 0x9032 r/w timer 3 pre-scale register 0xff tpre4 0x9042 r/w timer 4 pre-scale register 0xff tprex bit description initial state pre-scale [7:0] this field can determines pre-scale value for timer 0,1,2,3, and 4 0xff timer 0, 1, and 2 data registers register offset address r/w description reset value tdat0 0x9000 r/w timer 0 data register 0xffff tdat1 0x9010 r/w timer 1 data register 0xffff tdat2 0x9020 r/w timer 2 data register 0xffff tdat0,1,2 bit description initial state data [15:0] this field can determine the data value for timer 0,1, and 2 0xffff
timer S3C3410X risc microprocessor 8- 10 timer 3 and 4 data register & fifo registers register offset address r/w description reset value tdat3 0x9031 r/w timer 3 data register 0xff tdat4 0x9041 r/w timer 4 data register 0xff tfb4 0x904b r/w timer 4 fifo register @ byte access, fifo 0x0 tfhw4 0x904a r/w timer 4 fifo register @ half-word access, fifo 0x0 tfw4 0x9048 r/w timer 4 fifo register @ word access, fifo 0x0 tdat3, 4: non fifo mode, byte access (by strb) tdat3, 4 bit size description initial state tdata [7:0] timer data for timer 3 and 4 0xff tfb4: byte access, fifo mode tfb4 bit size description initial state tdata [7:0] timer data for timer 4 fc(fifo count) = fc(fifo count) + 1 0x0 tfhw4: half-word access, fifo mode tfhw4 bit size description initial state tdata 8 bit 8 bit timer data0 for timer 4 timer data1 for timer 4 fc(fifo count) = fc(fifo count) + 2 0x0 tfw4: word access, fifo mode tfw4 bit size description initial state tdata 8 bit 8 bit 8 bit 8 bit timer data0 for timer 4 timer data1 for timer 4 timer data2 for timer 4 timer data3 for timer 4 fc(fifo count) = fc(fifo count) + 4 0x0
S3C3410X risc microprocessor timer 8- 11 timer 0, 1, and 2 count registers register offset address r/w description reset value tcnt0 0x9006 r timer 0 count register 0x0 tcnt1 0x9016 r timer 1 count register 0x0 tcnt2 0x9026 r timer 2 count register 0x0 tdat0,1,2 bit description initial state cv [15:0] this field contains the current timer's count value during the normal operation 0x0 timer 3 and 4 count registers register offset address r/w description reset value tcnt3 0x9037 r timer 3 count register 0x0 tcnt4 0x9047 r timer 4 count register 0x0 tdat3, 4 bit size description initial state cv [7:0] this field contains the current timer's count value during the normal operation 0x0
timer S3C3410X risc microprocessor 8- 12 notes
S3C3410X risc microprocessor uart 9- 1 9 uart overview the uart(universal asynchronous receiver and transmitter) in S3C3410X can support one asynchronous serial i/o ports. the uart can be operated by the interrupt-based or dma-based mode. in other words, the uart can generate an interrupt or dma request to prepare the data to be sent, or to store the received data into the memory. it has two 8-byte fifos for receive and transmit. one is for receiving fifo and the other is for transmitting fifo. the functionality of uart includes the programmable baud-rate, frame format suitable for infra-red (irda ver. 1.0) transmit/receive, programmable number of stop bit insertion, programmable data width of 5, 6, 7, and 8-bit, and parity checking/attaching capability of received/transmitted data. the uart has a baud-rate generator, transmitter/receiver block and their control unit as shown in figure 9-1. the baud-rate generator can generate the suitable baud rate for uart by using mclk. to generate the proper baud rate, users should configure the proper division rate of mclk in special register in baud rate generator. to support the higher baud rate, the uart in S3C3410X has internal 8-byte fifo. the data in fifo should be transferred into transmitter shifter for tx and data in receive shifter should be moved into fifo for rx. the tx data in transmitter shifter will be shifted out through the utxd pin for tx case. also, the data on urxd will also be shifted in receive shifter for rx case. transmit shifter transmitter transmit fifo(8 byte) baud-rate generator receive shifter receive fifo(8 byte) receiver control unit utxd urxd clock source figure 9-1. uart block diagram with fifo
uart S3C3410X risc microprocessor 9- 2 uart function description uart operation the following section describe the operation of uart which include the data transmission, data reception, interrupt generation, baud-rate generation, loopback mode, infra-red mode, and so on. data transmission the data frame for transmission is programmable. it can have several options regarding to the data size, number of stop bit, parity checking capability, and so on, which can be specified in the line control register(ulcon). sometimes, users need to send the break condition during the sending the uart frame. the break condition can be realized by writing sbs bit in ucon register. if users write the sbs bit in ucon register during the uart frame sending, the break condition forces the serial output to logic 0 state at least for longer time than one frame transmission after successful sending the current uart frame. this break condition will be automatically cleared after one frame of break time. the uart will send the frame data again after break time. on the receive side, if the receive controller recognize the break condition from transmitter, there will be break interrupt to cpu. the data transmission process is shown in figure 9-2. the transmitter should transfer the data through a path as follows: data source -> transmit holding(transmit fifo) register -> transmit shifter -> utxd pin. two flags(status signals) such as transmit holding(transmit fifo) register empty and transmitter empty, are used to indicate the status of the transmit holding(transmit fifo) register and transmitter. start ubrdiv, ulcon, ucon is configured transmit holding register empty? transfer the data to transmit shifter set the transmit holding register empty flag after shift out last stop bit, set the transmitter empty flag y n figure 9-2. uart data transmission process
S3C3410X risc microprocessor uart 9- 3 data reception the rx block of uart can also support several options necessary for uart frame receiving as similar with tx. it can support the option on data size, number of stop bit, parity checking capability, and so on, which can also be specified in the line control register(ulcon). the receiver block of uart can detect the erroneous such as overrun error, parity error, frame error and break condition from tx. the overrun error indicates that new data has overwritten the previously received data before the previous one has been read. the parity error indicates that the receiver has detected a parity error, which is due to different parity bit from the expectation. the frame error indicates that the received data does not have a valid stop bit in terms of frame boundary. the break condition indicates that the urxd input is held in the logic 0 state at least for longer time than one frame transmission. the receive time-out condition occurs when the uart receiver does not receive the data during the necessary time of 3 half-word (6 bytes) transmission when the rx fifo is not empty state in fifo mode. the data reception process is shown in figure 9-3. the receiver transfer data through a path as follows: urxd pin -> receive shifter register -> receive buffer register -> destination. a receive buffer (receive fifo) full flag as well as several error flags during the reception can be used to indicate the status of the receive buffer (receive fifo) register. start ubrdiv, ulcon, ucon is configured data reception detected ? transfer the data to receive shifter set the receive buffer (receive fifo) full flag n y receive data into receive shifter from urxd pin figure 9-3. uart data reception process
uart S3C3410X risc microprocessor 9- 4 interrupt / dma request generation the uart of S3C3410X has eight status signals: overrun error, parity error, frame error, break, receive fifo ready, receiver time out, transmit fifo empty and transmitter empty, which are specified in the corresponding uart status register(ustat). the overrun error, parity error, frame error and break condition are referred to as the receive status, each of which can cause the receive status interrupt request if the receive status interrupt enable bit is set to one in the control register(ucon). when a receive status interrupt request is detected, users can know the interrupt source by reading the content of ucon register. when the receiver transfers the data in the receive shifter to the receive fifo, there will be the activation of the receive fifo ready status signal, which will cause the receive interrupt if the receive mode in control register is selected as the interrupt mode. when the transmitter transfers the data in the transmit fifo to transmit shifter, there will be the activation of the transmit fifo empty status signal, which will cause the transmit interrupt if the transmit mode in control register is selected as the interrupt mode. the receive fifo ready and transmit fifo empty status signals can also be connected to generate the dma request signals if the receive/transmit mode is selected as the dma mode. interrupt generation relating with fifo type fifo mode non-fifo mode rx interrupt when uart receive one frame data, it should move the data into fifo. after loading the data into fifo, it should determine whether an interrupt should be generated by looking the fifo trigger level, or not. when uart receives one frame data successfully, it will generate an interrupt. tx interrupt when uart transmit one frame data, it should extract the data from fifo. after extracting the data from fifo, it should determine whether an interrupt should be generated by looking the fifo trigger level, or not. when uart transmits one frame data successfully, it will generate an interrupt. error interrupt when uart detects the frame error, parity error and break condition, it does not generate the interrupt immediately. the uart will move the data into receive fifo and it will generate the interrupt when the data move to the top of receive fifo. however, an overrun error as well as receive time-out should generate an interrupt immediately. all erroneous condition should generate an error interrupt immediately. however, if several interrupt happen simultaneously, the interrupt routine should discriminate the interrupt source by looking the content of ucon register.
S3C3410X risc microprocessor uart 9- 5 baud rate generation the uart's baud-rate generator provides the serial clock for transmitter and receiver. the source clock for the baud-rate generator should be the S3C3410X's internal system clock. the baud-rate clock is generated by dividing the source clock by 16 and a 16-bit divisor specified by the uart baud-rate divisor register (ubrdiv). the ubrdiv can be determined as follows: ubrdiv = (round_off) { mclk / ( transfer rate 16 ) } ? 1 where the divisor should be from 1 to (2 16 ? 1). for example, if the baud-rate is 115200bps and mclk is 40mhz, ubrdiv is: ubrdiv = (int) { mclk / ( transfer rate 16 ) + 0.5 } ? 1 = (int) { 40000000 / ( 115200 * 16 ) + 0.5 } ? 1 = (int) ( 21.7 + 0.5 ) ? 1 = 22 ? 1 = 21 loop back mode the S3C3410X uart can support a test mode, so called the loop back mode. in this mode, the transmitted data from uart tx module is immediately received through uart rx module via internal connection between tx and rx module. this feature allows that the processor can verify the internal transmit/receive data path of uart channel. this mode can be selected by setting the loop back bit in the uart control register(ucon). infra red(irda) mode the uart in S3C3410X can support the frame of infra-red (irda) transmit and receive, which can be selected by setting the infra-red bit in the uart control register (ucon). as shown in figure 9-4, we should have irda tx encoder and rx decoder, which is different from the normal uart operation mode. by using the specific decoder/encoder for irda, the signal frame in irda is different from the normal signal frame of uart, which is shown in figure 9-5, 9-6 and 9-7. in irda transmit mode, the transmitter should pulse 3/16 duty to represent a zero data as shown in figure 9-6. in irda receive mode, the receiver should detect the 3/16 pulsed period to recognize a zero data as shown in figure 9-7. irda tx encoder irda tx encoder txd irs rxd re uart block utxd urxd 0 1 0 1 figure 9-4. irda function block diagram
uart S3C3410X risc microprocessor 9- 6 start bit stop bit 1 1 1 1 1 0 0 0 0 0 data bit uart frame figure 9-5. serial i/o frame timing diagram (normal uart) start bit stop bit 1 1 1 1 1 0 0 0 0 0 data bit ir transmit frame bit time pulse width = 3/16 bit frame figure 9-6. infra red(irda) transmit mode frame timing diagram start bit stop bit 1 1 1 1 1 0 0 0 0 0 data bit ir receive frame figure 9-7. infra red(irda) receive mode frame timing diagram
S3C3410X risc microprocessor uart 9- 7 uart special function registers uart line control register (ulcon) this is uart line control register, ulcon, is used to control uart block. register offset address r/w description reset value ulcon 0x5003 r/w uart line control register 0x0 ulcon bit description initial state wl [1:0] word length: the word length indicates the number of data bit to be transmitted or received per frame 00 = 5-bits 01 = 6-bits 10 = 7-bits 11 = 8-bits 00 sb [2] number of stop bit: the number of stop bit per frame should be specified by using sb. 0 = one stop bit per frame 1 = two stop bit per frame 0 pmd [5:3] parity mode: the parity mode can specify the parity mode. when the parity mode is enabled, the parity generation for tx and parity checking for rx will be performed automatically during the tx and rx operation of uart. 0xx = no parity 100 = odd parity 101 = even parity 000 irm [6] infra-red mode : the infra-red mode can determine whether or not to be use the infra-red mode. 0 = normal mode operation 1 = infre-red tx/rx mode 0
uart S3C3410X risc microprocessor 9- 8 uart control register (ucon) register offset address r/w description reset value ucon 0x5007 r/w uart control register 0x0 ucon bit description initial state rm [1:0] receive mode: this field can determine the operation mode of uart. the uart can be operated by dma as well as interrupt mechanism. if the interrupt is not enabled, it is polling mode. 00 = disable 01 = interrupt request or polling mode 10 = dma0 request 11 = dma1 request 00 tm [3:2] transmit mode: this field can determine the operation mode of uart. the uart can be operated by dma as well as interrupt mechanism. if the interrupt is not enabled, it is polling mode. 00 = disable 01 = interrupt request or polling mode 10 = dma0 request 11 = dma1 request 00 sbs [4] send break signal: setting this bit can cause the uart to send a break signal. 0 = normal transmit 1 = send break signal 0 lbm [5] loop back mode: setting loop back bit to "1" can cause the uart to enter loop back mode. the loop back mode means the internal connection between tx and rx module for test purpose. 0 = normal operation 1 = loopback mode 0 rsie [6] rx status interrupt enable: this bit enables the uart to generate an interrupt if an exception, such as a break, frame error, parity error, or overrun error occurs during a receive operation. 0 = do not generate receive status interrupt 1 = generate receive status interrupt 0 rxtoel [7] rx time out enable: enable/disable rx time out interrupt. this bit is only effective when the fifo is enabled. 0 = disable 1 = enable 0
S3C3410X risc microprocessor uart 9- 9 uart status register (ustat) the uart status register, ustat, is a read-only register which is used to monitor the status during the operation of serial i/o in the uart register offset address r/w description reset value ustat 0x500b r uart status register 0xc0 ustat bit description initial state oe [0] overrun error: this bit is automatically set to "1" whenever an overrun error occurs during the receive operation. 0 = no overrun error during receive 1 = overrun error 0 pe [1] parity error: this bit is automatically set to "1" whenever an parity error occurs during the receive operation. 0 = no parity error during receive 1 = parity error 0 fe [2] frame error: this bit is automatically set to "1" whenever an frame error occurs during the receive operation. 0 = no frame error during receive 1 = frame error 0 bd [3] break detect: this bit is automatically set to "1" to indicate that a break signal has been received. 0 = no break received 1 = break received 0 rto [4] receiver time out: this bit is automatically set to "1" whenever a receiver time out occurs during the receive operation. 0 = no receiver time out during receive 1 = generate receiver time out 0 rfdr [5] receive fifo data ready / receive buffer data ready: this bit is automatically set to "1" whenever the receiver is ready to receive the data through the urxd pin. 0 = completely empty 1 = 1-byte rx fifo data 8-byte @ fifo mode the buffer register has a received data @ non fifo mode 0 tfe [6] transmit fifo empty / transmit holding register empty: this bit is automatically set to "0" whenever the transmitter has the valid data for sending. 0 = 1-byte fifo 8-byte @ fifo mode the holding register is not empty @ non fifo mode 1 = empty 1 tse [7] transmit shift register empty: this bit is automatically set to "1" whenever the transmit shift register does not have a valid data for sending. 0 = not empty 1 = transmit holding & shifter register empty 1
uart S3C3410X risc microprocessor 9- 10 uart fifo control register (ufcon) register offset address r/w description reset value ufcon 0x500f r/w uart fifo control register 0x0 ufcon bit description initial state fe [0] fifo enable: this bit can determine whether or not to use the fifo mode. 0 = fifo disable 1 = fifo enable 0 rfr [1] receive fifo reset: to reset the receive fifo, user should set rfr bit. 0 = normal mode 1 = rx fifo reset 0 tfr [2] transmit fifo reset: to reset the transmit fifo, user should set tfr bit. 0 = normal mode 1 = tx fifo reset 0 reserved [3] reserved 0 rftl [5:4] receive fifo trigger level for interrupt generation: this field can determine the interrupt trigger level of receive fifo. 00 = 2 byte 01 = 4 byte 10 = 6 byte 11 = 8 byte 00 tftl [7:6] transmit fifo trigger level for interrupt generation: this field can determine the interrupt trigger level of transmit fifo. 00 = empty 01 = 2 byte 10 = 4 byte 11 = 6 byte 00
S3C3410X risc microprocessor uart 9- 11 uart fifo status register (ufstat) register offset address r/w description reset value ufstat 0x5012 r uart fifo control register 0x0 ufstat bit description initial state rfc [2:0] receive fifo count: this field can indicate the number of current data in receive fifo. 000 tfc [5:3] transmit fifo count: this field can indicate the number of current data in transmit fifo. 000 rff [6] receive fifo full: this bit is automatically set to "1" whenever receive fifo is full during receive operation. 0 = 0 rx fifo data 7 byte 1 = full 0 tff [7] transmit fifo full: this bit is automatically set to "1" whenever transmit fifo is full during transmit operation. 0 = 0 rx fifo data 7 byte 1 = full 0 eif [8] error in fifo: this bit represent that there is not valid data in the receive fifo. 0 = all data in receive fifo are valid 1 = some data in receive fifo is not valid. 0
uart S3C3410X risc microprocessor 9- 12 uart transmit holding register & fifo registers register offset address r/w description reset value utxh 0x5017 w uart transmit holding register 0x0 utxh_b 0x5017 w uart transmit fifo register @ byte access 0x0 utxh_hw 0x5016 w uart transmit fifo register @ half-word access 0x0 utxh_w 0x5014 w uart transmit fifo register @ word access 0x0 utxh bit description initial state txdata [7:0] this field represents the data to be transmitted through tx module in uart. when users write the data in this register, the transmit holding register empty bit(tfe) in the status register should be set to "0". this bit is for preventing the overwriting on transmitted data that may already be existed in the utxh register. users should update the utxh after checking tfe bit. whenever the utxh is written with new value, the transmit register empty bit(tfe) will be automatically cleared to "0" 0x0 utxh_b : byte access, fifo mode utxh_b bit description initial state txdata0 [7:0] transmit data for uart; when users write the byte data in this register, fifo_count = fifo_count + 1 0x0 utxh_hw : half-word access, fifo mode utxh_hw bit description initial state txdata0 txdata1 [7:0] [15:8] transmit data0 for uart transmit data1 for uart when users write the half-word data in this register, fifo_count = fifo_count + 2 0x0 0x0 utxh_w : word access, fifo mode utxh_w bit description initial state txdata0 txdata1 txdata2 txdata3 [7:0] [15:8] [23:16] [31:24] transmit data0 for uart transmit data1 for uart transmit data2 for uart transmit data3 for uart when users write the word data in this register, fifo_count = fifo_count + 4 0x0 0x0 0x0 0x0
S3C3410X risc microprocessor uart 9- 13 uart receive buffer register & fifo registers register offset address r/w description reset value urxh 0x501b w uart receive buffer register ? urxh_b 0x501b w uart receive fifo register @ byte access ? urxh_hw 0x501a w uart receive fifo register @ half-word access ? urxh_w 0x5018 w uart receive fifo register @ word access ? urxh bit description initial state rxdata [7:0] this field represents the data to be received through rx module in uart. when users read the data in this register, the receive buffer data ready bit(rfdr) in the status register should be set to "0". this bit is for preventing the reading the invalid received data in the urxh register before successful reception. users should read the urxh after checking rfdr bit. whenever the urxh is read, the receive buffer data ready bit(rfdr) in the status register will be automatically cleared to "1" ? urxh_b : byte access, fifo mode urxh_b bit description initial state rxdata0 [7:0] receive data for uart; when users read the byte data in this register, fifo_count = fifo_count + 1 ? urxh_hw : half-word access, fifo mode urxh_hw bit description initial state rxdata0 rxdata1 [7:0] [15:8] receive data0 for uart receive data1 for uart when users read the half-word data in this register, fifo_count = fifo_count + 2 ? urxh_w : word access, fifo mode urxh_w bit description initial state rxdata0 rxdata1 rxdata2 rxdata3 [7:0] [15:8] [23:16] [31:24] receive data0 for uart receive data1 for uart receive data2 for uart receive data3 for uart when users read the word data in this register, fifo_count = fifo_count + 4 ?
uart S3C3410X risc microprocessor 9- 14 uart baud rate divisor register (ubrdiv) the value in the baud rate divisor register, ubrdiv, can be used to determine the uart tx/rx clock rate(baud rate) as follows: ubrdiv = (round_off) { mclk / ( transfer rate 16 ) } ? 1 where the divisor should be from 1 to (2 16 ? 1). for example, if the baud-rate is 115200bps and mclk is 40mhz, ubrdiv is: ubrdiv = (int) { mclk / ( transfer rate 16 ) + 0.5 } ? 1 = (int) { 40000000 / ( 115200 * 16 ) + 0.5 } ? 1 = (int) ( 21.7 + 0.5 ) ? 1 = 22 ? 1 = 21 register offset address r/w description reset value ubrdiv 0x501e r/w baud rate divisor register for uart 0x0 ubrdiv bit description initial state ubrdiv [15:0] baud rate divisor value 0x0
S3C3410X risc microprocessor sio 10- 1 10 sio (synchronous i/o) overview the S3C3410X sio(synchronous i/o) can interface with various types of external devices which requires the serial data transfer/receive. the sio module can transmit or receive 8-bit serial data at a frequency determined by its corresponding control register. to ensure the flexible data transmission rate, users can select an internal or external clock source. mclk 8-bit prescaler sioclk 8-bit sio shift buffer sio control logic 3-bit counter 8 data bus siorxd siotxd siordy sioint figure 10-1. sio function block diagram
sio s3c3 410x risc microprocessor 10- 2 sio function description non-dma mode operation transmit and receive by synchronous serial line the 8-bit data can be transmitted and received through sio port. the serial output data can go out through a serial output pin(siotxd), and the serial input data can come through a serial input pin(siorxd). in this case, the data should be sent and received synchronously by serial clock pin(sioclk). after transmitting or receiving data, the sio interrupt request will be activated if users enable an interrupt for sio tx and rx. because of the separate hardware for tx and rx, the dual operation of tx and rx is possible. if users want to use the receiving operation, users can treat the receive data as dummy one. the tx and rx rate can be controlled by having the appropriate configuration in the siocon and sbrdr registers. the clock source of serial interface can be an internal or external clock. in other words, the tx and rx rate are programmable and users can determine the rate by having a suitable configuration in the siocon and sbrdr registers. programming procedure when users write a byte data into the siodat register, the sio will start to transmit a data if the sio run bit is set and the transmit mode bit is enabled. to program the operation of sio modules, please take following steps: 1. configure the mult iplexed i/o pins as sio related ones(siotxd, siorxd, sioclk, and siordy). 2. configure the siocon register to have a necessary functionality of the serial i/o module. 3. for the operation of interrupt mode in sio, configure the interrupt mode in siocon register and enable interrupt-relating bits in interrupt controller. 4. in case of interrupt mode for tx, users should write a data to be transmitted in siodat, first. to start the transmission, users should write sb(sio start) bit in siocon register. after transmission, there should be sio interrupt. in case of interrupt mode of rx, there will be sio interrupt after receipt. to start the receiving operation, users should write sb bit in siocon register. 5. go to step 4 if users need interrupt-based sio operation more.
S3C3410X risc microprocessor sio 10- 3 sioclk siorxd siotxd siocon start bit do7 di7 do6 di6 do5 di5 do4 di4 do3 di3 do2 di2 do1 di1 do0 di0 transmit complete figure 10-2. synchronous i/o timing transmit/receive mode (tx at falling) sioclk siorxd siotxd do7 di7 do6 di6 do5 di5 do4 di4 do3 di3 do2 di2 do1 di1 do0 di0 siocon start bit transmit complete figure 10-3. synchronous i/o transmit/receive mode (tx at rising)
sio s3c3 410x risc microprocessor 10- 4 dma mode operation hand-shaking mode (flag run mode) in case of dma-base sio operation, there can be consecutive frame tx and rx. between frames(for example, tx frame and next tx frame), sio can watch the siordy signal to check whether receiving sio is busy, or not. this is hand-shaking mode. if rx sio is not ready, tx sio can not send the frame and should wait until rx sio is available. to indicate the busy state, siordy signal should below. non hand-shaking mode (auto run mode) the non-hand-shaking mode means that sio can transmit its data without watching siordy signal during the consecutive operation. in stead of watching siordy signal, users can have programmable duration between frames. the duration can be specified in ivtcnt register in sio module. steps for transmit by dma 1. for the operation of dma mode for tx in sio, have a suitable configuration in dma-related register in dma controller, first. the trs bit in siocon register should be 1. 2. configure the dma mode in siocon register. 3. the sio requests dma service 4. the sio transmits th e data (the first transmitted data is in the first source address of dma) 5. go to step 3 until dma count is "0" steps for receive by dma 1. for the operation of dma mode for rx in sio, have a suitable configuration in dma-related register in dma controller, first. the trs bit in siocon register should be 0. 2. configure the dma mode in siocon register. the sb(sio start) bit should also be set. 3. the sio requests the dma service after 8-bit data has been received. 4. go to step 4 until dma count is "0"
S3C3410X risc microprocessor sio 10- 5 siordy sioclk siotxd siorxd siocon start bit transmit complete dma condition setting ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ figure 10-4. synchronous i/o timing in hand-shaking mode (flag run mode) sioclk siotxd siorxd siocon start bit transmit complete dma condition setting interval time ~ ~ ~ ~ ~ ~ ~ ~ figure 10-5. synchronous i/o timing in non hand-shaking mode (auto run mode)
sio s3c3 410x risc microprocessor 10- 6 synchronous i/o special function registers synchronous i/o control registers (siocon0, siocon1) there are two control register for synchronous i/o interface module, siocon0 and siocon1. to determine the sio operation, users should configure a necessary option on this register. register offset address r/w description reset value siocon0 0x6003 r/w synchronous i/o 0 control register 0x0 siocon1 0x7003 r/w synchronous i/o 1 control register 0x0 sioconx bit description initial state mode [1:0] sio mode selection: this field can determine the sio operation mode for sio tx and rx. 00 = disable 01 = sio interrupt 10 = dma0 request 11 = dma1 request 00 hse [2] hand-shaking mode enable: in dma-based sio operation, users can have hand-shaking or non-hand-shaking mode. in hand-shaking mode, sio controller should watch siordy signal before the sending of next frame. in non-hand-shaking mode, users can have programmable duration between consecutive frames. 0 = non hand-shaking mode (auto run mode) 1 = hand-shaking mode (flag run mode) 0 sb [3] sio start: to start sio operation, users should set this bit. 0 = no action 1 = clear 3-bit counter and start shift 0 ces [4] clock edge select: this bit can determine what clock edge should be used for serial transmission. if this bit is set to "0" for transmission, the transmitting operation is executed at the falling edge, and the receiving operation is executed at the rising edge. 0 = falling edge clock to tx 1 = rising edge clock to tx 0 trs [5] transmit/receive selection: this bit can decide that the current sio is configured as receiver only, or transmitter/receiver. the receiver only mode is just for dma- based receive operation. for dma-based tx and interrupt-based tx/rx operation, users should have trs as 1. in case of tx/rx mode, sio can receive the data from external device without s/w control. in this case, users should determine whether the received data is valid, or not. 0 = received only mode 1 = transmit/receive mode 0 dd [6] data direction: this bit can control whether msb should be transmitted first or lsb is transmitted first. 0 = msb mode 1 = lsb mode 0 cs [7] sio clock source selection: this bit can determine the clock source for sio. 0 = internal clock 1 = external clock 0
S3C3410X risc microprocessor sio 10- 7 sio data registers (siodat0, siodat1) to send the data by sio, users should write the data in the sio data register (siodat0, siodat1) before sending. as well as transmission, the received data can also be stored. even if the receive operation can not be controlled by s/w, the users should decide whether the received data is valid, or not. for example, this decision can be made by the interrupt service routine. if users do not want the received data, users should think the data in sio data register as dummy one. register offset address r/w description reset value siodat0 0x6002 r/w synchronous i/o 0 data register 0x0 siodat1 0x7002 r/w synchronous i/o 1 data register 0x0 siodatx bit description initial state siodata [7:0] sio data: the field represent the data to be transmitted or received over the sio channel. 0x0 sio baud rate prescaler registers (sbrdr0, sbrdr1) the value stored in the baud rate divisor register (sbrdr0, sbrdr1), allows users to determine the sio clock rate (baud rate) as follows: baud rate = ckin / { 2 ( divisor value + 1) } register offset address r/w description reset value sbrdr0 0x6001 r/w synchronous i/o 0 baud rate pre-scale register 0x0 sbrdr1 0x7001 r/w synchronous i/o 1 baud rate pre-scale register 0x0 siodatx bit description initial state pre-scale [7:0] the field has a pre-scale value for generating the baud rate. 0x0
sio s3c3 410x risc microprocessor 10- 8 sio interval counter registers (itvcnt0, itvcnt1) in case of the non hand-shaking mode(auto run mode), users should have the duration between consecutive frames. the duration between frames can be calculated by below formula. intervals time(between 8-bit data) = (itvcnt + 1) 256 2 / ckin register offset address r/w description reset value itvcnt0 0x6000 r/w synchronous i/o 0 interval counter register 0x00 itvcnt1 0x7000 r/w synchronous i/o 1 interval counter register 0x00 itvcntx bit description initial state count value [7:0] this field contains the interval time value for the dma non hand- shaking mode. 0x00
S3C3410X risc microprocessor interrupt controller 11- 1 11 interrupt controller overview in S3C3410X, there are 35 interrupt sources. among them, 23 interrupt sources are coming from internal peripheral devices like the dma controller, uart, sio, etc. other 8 interrupt sources are coming from external interrupt request pins like eint0, eint1, eint2, eint3, eint8, eint9, eint10, and eint11. the other 4 are coming from external interrupt request pins like eint4, eint5, eint6, and eint7. because these 4 external interrupt requests should be or-ed internally, we consider these external interrupt request sources as one interrupt request source to cpu. in other word, the total interrupt request sources to cpu is 32, not 35. even if there are many interrupt request sources, the arm7tdmi core can only recognize all interrupt as two kinds of interrupt: a normal interrupt request(irq) and a fast interrupt request(fiq). therefore, all interrupt sources in S3C3410X should be categorized as either irq or fiq. the multiple interrupt sources should be controlled by three kind of information in special registers in interrupt controller. these are intmod, intpnd, and intmsk register. the role of three registers in interrupt controller is as follow. in S3C3410X, the interrupt controller can support the interrupt base vector address as well as programmable priority. to reduce the interrupt latency, the interrupt controller in S3C3410X can assign the hard-wired vector address for each interrupt source. the total 32 interrupt request sources to cpu can have the programmable priority. this kind of programmable priority can make users to have more intelligent interrupt handling. interrupt mode register: defines the interrupt mode for each interrupt source, which is irq or fiq. by having the configuration for each interrupt source in this register, users can allocate all interrupt sources as irq or fiq mode interrupt. interrupt pending register: in cpu core, there is psr(processor status register) register, which has several field including the interrupt relating i-flag and f-flag. as mentioned above, the cpu can accept two kinds of interrupt even if there are many interrupt sources in S3C3410X. that is why all interrupt sources in S3C3410X should be categorized into two mode, which is irq mode and fiq mode. in this case, if cpu is running the service for certain interrupt, and if this interrupt has irq mode, the other interrupt sources with irq mode can not be serviced until the completion of current service. these interrupt should be pending in ipr(interrupt pending register). in case of fiq mode, other fiq interrupt request can not take cpu while the current fiq service is running as same as irq case. therefore, the fiq interrupt request should be pending in ipr as same as irq. if irq interrupt service is running, the fiq interrupt can take the cpu for service because fiq has higher priority than irq. in other word, arm cpu can support two level interrupt architecture. the pending interrupt service can start whenever the i-flag or f-flag should be cleared to "0". the service routine should clear the pending bit, also. interrupt mask register: if this mask bit is set, the corresponding interrupt request should be disabled. users can select the interrupt enable or disable by using this register. for masking(disable the interrupt), the corresponding mask bit should be "0".
interrupt controller S3C3410X risc micr oprocessor 11- 2 interrupt source in S3C3410X, there are 35 interrupt sources. among them, 23 interrupt sources are coming from internal peripheral devices like the dma controller, uart, sio, etc. other 8 interrupt sources are coming from external interrupt request pins like eint0, eint1, eint2, eint3, eint8, eint9, eint10, and eint11. the other 4 are coming from external interrupt request pins like eint4, eint5, eint6, and eint7. because these 4 external interrupt requests should be or-ed internally, we consider these external interrupt request sources as one interrupt request source to cpu. in other word, the total interrupt request sources to cpu is 32, not 35. sources description number eint0 external interrupt 0 0 eint1 external interrupt 1 1 int_urx uart receive interrupt 2 int_utx uart transmit interrupt 3 int_uerr uart error interrupt 4 int_dma0 dma0 interrupt 5 int_dma1 dma1 interrupt 6 int_tof0 timer 0 overflow interrupt 7 int_tmc0 timer 0 match/capture interrupt 8 int_tof1 timer 1 overflow interrupt 9 int_tmc1 timer 1 match/capture interrupt 10 int_tof2 timer 2 overflow interrupt 11 int_tmc2 timer 2 match/capture interrupt 12 int_tof3 timer 3 overflow interrupt 13 int_tmc3 timer 3 match/capture interrupt 14 int_tof4 timer 4 overflow interrupt 15 int_tmc4 timer 4 match/capture interrupt 16 int_bt basic timer interrupt 17 int_sio0 sio 0 interrupt 18 int_sio1 sio 1 interrupt 19 int_iic iic interrupt 20 int_rtca rtc alarm interrupt 21 int_rtct rtc time interrupt(sec/min/hour) 22 int_tf timer4 fifo interrupt 23 eint2 external interrupt 2 24 eint3 external interrupt 3 25 eint4/5/6/7 external interrupt 4/5/6/7 26 int_adc adc interrupt 27 eint8 external interrupt 8 28 eint9 external interrupt 9 29 eint10 external interrupt 10 30 eint11 external interrupt 11 31 note: eint4, eint5, eint6 and eint7 are sharing the same interrupt request line. so, the isr(interrupt service routine) can discriminate the interrupt request source by reading the eintpnd register because it has 4-bit for the interrupt source of eint4, eint5, eint6, and eint7. the eintpnd has to be cleared by writing "0" in isr
S3C3410X risc microprocessor interrupt controller 11- 3 interrupt controller special function registers interrupt mode register (intmod) each bit in intmod register can determine the interrupt mode of each interrupt request. in case of fiq mode, this bit should be "1". otherwise, it means the irq mode interrupt. the fiq mode has higher priority than irq mode. during the service of irq, the fiq mode interrupt can occupy the cpu for its service. register offset address r/w description reset value intmod 0xc000 r/w interrupt mode register 0 = irq mode 1 = fiq mode 0x0 intmod bit description initial state eint0 [0] 0 = irq mode 1 = fiq mode 0 eint1 [1] 0 = irq mode 1 = fiq mode 0 int_urx [2] 0 = irq mode 1 = fiq mode 0 int_utx [3] 0 = irq mode 1 = fiq mode 0 int_uerr [4] 0 = irq mode 1 = fiq mode 0 int_dma0 [5] 0 = irq mode 1 = fiq mode 0 int_dma1 [6] 0 = irq mode 1 = fiq mode 0 int_tof0 [7] 0 = irq mode 1 = fiq mode 0 int_tmc0 [8] 0 = irq mode 1 = fiq mode 0 int_tof1 [9] 0 = irq mode 1 = fiq mode 0 int_tmc1 [10] 0 = irq mode 1 = fiq mode 0 int_tof2 [11] 0 = irq mode 1 = fiq mode 0 int_tmc2 [12] 0 = irq mode 1 = fiq mode 0 int_tof3 [13] 0 = irq mode 1 = fiq mode 0 int_tmc3 [14] 0 = irq mode 1 = fiq mode 0 int_tof4 [15] 0 = irq mode 1 = fiq mode 0 int_tmc4 [16] 0 = irq mode 1 = fiq mode 0 int_bt [17] 0 = irq mode 1 = fiq mode 0 int_sio0 [18] 0 = irq mode 1 = fiq mode 0 int_sio1 [19] 0 = irq mode 1 = fiq mode 0 int_iic [20] 0 = irq mode 1 = fiq mode 0 int_rtca [21] 0 = irq mode 1 = fiq mode 0
S3C3410X risc microprocessor interrupt controller 11- 4 intmod bit description initial state int_rtct [22] 0 = irq mode 1 = fiq mode 0 int_tf [23] 0 = irq mode 1 = fiq mode 0 eint2 [24] 0 = irq mode 1 = fiq mode 0 eint3 [25] 0 = irq mode 1 = fiq mode 0 eint4/5/6/7 [26] 0 = irq mode 1 = fiq mode 0 int_adc [27] 0 = irq mode 1 = fiq mode 0 eint8 [28] 0 = irq mode 1 = fiq mode 0 eint9 [29] 0 = irq mode 1 = fiq mode 0 eint10 [30] 0 = irq mode 1 = fiq mode 0 eint11 [31] 0 = irq mode 1 = fiq mode 0
S3C3410X risc microprocessor interrupt controller 11- 5 interrupt pending register (intpnd) in cpu core, there is psr(processor status register) register, which has several field including the interrupt relating i-flag and f-flag. as mentioned above, the cpu can accept two kinds of interrupt even if there are many interrupt sources in S3C3410X. that is why all interrupt sources in S3C3410X should be categorized into two mode, which is ifq mode and fiq mode. in this case, if cpu is running the service for certain interrupt, and if this interrupt has irq mode, the other interrupt sources with irq mode can not be serviced until the completion of current service. these interrupt should be pending in ipr(interrupt pending register). in case of fiq mode, other fiq interrupt request can not take cpu while the current fiq service is running as same as irq case. therefore, the fiq interrupt request should be pending in ipr as same as irq. if irq interrupt service is running, the fiq interrupt can take the cpu for service because fiq has higher priority than irq. in other word, arm cpu can support two level interrupt architecture. the pending interrupt service can start whenever the i- flag or f-flag should be cleared to "0". the service routine should clear the pending bit, also. register offset address r/w description reset value intpnd 0xc004 r/w interrupt pending register. indicates the interrupt request status of each source. 0 = the interrupt has not been requested (when reading) 0 = clear pending bit (when writing) 1 = the interrupt source has asserted the interrupt request (when reading) 1 = no effect, keeping current status, '0' or '1'. (when writing) 0x0 intpnd bit description initial state eint0 [0] 0 = not requested 1 = requested 0 eint1 [1] 0 = not requested 1 = requested 0 int_urx [2] 0 = not requested 1 = requested 0 int_utx [3] 0 = not requested 1 = requested 0 int_uerr [4] 0 = not requested 1 = requested 0 int_dma0 [5] 0 = not requested 1 = requested 0 int_dma1 [6] 0 = not requested 1 = requested 0 int_tof0 [7] 0 = not requested 1 = requested 0 int_tmc0 [8] 0 = not requested 1 = requested 0 int_tof1 [9] 0 = not requested 1 = requested 0 int_tmc1 [10] 0 = not requested 1 = requested 0 int_tof2 [11] 0 = not requested 1 = requested 0 int_tmc2 [12] 0 = not requested 1 = requested 0 int_tof3 [13] 0 = not requested 1 = requested 0 int_tmc3 [14] 0 = not requested 1 = requested 0 int_tof4 [15] 0 = not requested 1 = requested 0 int_tmc4 [16] 0 = not requested 1 = requested 0 int_bt [17] 0 = not requested 1 = requested 0
S3C3410X risc microprocessor interrupt controller 11- 6 intpnd bit description initial state int_sio0 [18] 0 = not requested 1 = requested 0 int_sio1 [19] 0 = not requested 1 = requested 0 int_iic [20] 0 = not requested 1 = requested 0 int_rtca [21] 0 = not requested 1 = requested 0 int_rtct [22] 0 = not requested 1 = requested 0 int_tf [23] 0 = not requested 1 = requested 0 eint2 [24] 0 = not requested 1 = requested 0 eint3 [25] 0 = not requested 1 = requested 0 eint4/5/6/7 [26] 0 = not requested 1 = requested 0 int_adc [27] 0 = not requested 1 = requested 0 eint8 [28] 0 = not requested 1 = requested 0 eint9 [29] 0 = not requested 1 = requested 0 eint10 [30] 0 = not requested 1 = requested 0 eint11 [31] 0 = not requested 1 = requested 0
S3C3410X risc microprocessor interrupt controller 11- 7 interrupt mask register (intmsk) the interrupt mask register has interrupt mask bits for all interrupt source. when an interrupt source mask bit is "0", the corresponding interrupt can not be serviced by the cpu when the corresponding interrupt request is generated. if the mask bit is "1", the interrupt service can be done. register offset address r/w description reset value intmsk 0xc008 r/w interrupt mask register. each bit can disable or enable the corresponding interrupt request. 0 = interrupt service is masked or disabled. 1 = interrupt service is available 0x0 intmsk bit description initial state eint0 [0] 0 = masked 1 = service available 0 eint1 [1] 0 = masked 1 = service available 0 int_urx [2] 0 = masked 1 = service available 0 int_utx [3] 0 = masked 1 = service available 0 int_uerr [4] 0 = masked 1 = service available 0 int_dma0 [5] 0 = masked 1 = service available 0 int_dma1 [6] 0 = masked 1 = service available 0 int_tof0 [7] 0 = masked 1 = service available 0 int_tmc0 [8] 0 = masked 1 = service available 0 int_tof1 [9] 0 = masked 1 = service available 0 int_tmc1 [10] 0 = masked 1 = service available 0 int_tof2 [11] 0 = masked 1 = service available 0 int_tmc2 [12] 0 = masked 1 = service available 0 int_tof3 [13] 0 = masked 1 = service available 0 int_tmc3 [14] 0 = masked 1 = service available 0 int_tof4 [15] 0 = masked 1 = service available 0 int_tmc4 [16] 0 = masked 1 = service available 0 int_bt [17] 0 = masked 1 = service available 0 int_sio0 [18] 0 = masked 1 = service available 0 int_sio1 [19] 0 = masked 1 = service available 0 int_iic [20] 0 = masked 1 = service available 0 int_rtca [21] 0 = masked 1 = service available 0
S3C3410X risc microprocessor interrupt controller 11- 8 intmsk bit description initial state int_rtct [22] 0 = masked 1 = service available 0 int_tf [23] 0 = masked 1 = service available 0 eint2 [24] 0 = masked 1 = service available 0 eint3 [25] 0 = masked 1 = service available 0 eint4/5/6/7 [26] 0 = masked 1 = service available 0 int_adc [27] 0 = masked 1 = service available 0 eint8 [28] 0 = masked 1 = service available 0 eint9 [29] 0 = masked 1 = service available 0 eint10 [30] 0 = masked 1 = service available 0 eint11 [31] 0 = masked 1 = service available 0
S3C3410X risc microprocessor interrupt controller 11- 9 interrupt vector base address to reduce the interrupt latency, the S3C3410X can support the concept of interrupt vector base address. the interrupt vector base address means the start address of corresponding service routine. in other word, as soon as cpu recognize the interrupt request, there will be branch to fixed hardwired vector. but, because the cpu can support just two interrupt mode of fiq and irq, we need special technique to assign the specific base vector address for all interrupt source. to do this, the interrupt controller should give the branch instruction (branch to the fixed hardware vector address) to cpu as soon as the cpu recognize the interrupt request. because the interrupt controller can know the interrupt mode as well as source, the interrupt controller can give the specific vector address to cpu by h/w. following table shows the interrupt base vector address for each interrupt source. sources address sources address eint0 0x80 int_tmc4 0xc0 eint1 0x84 int_bt 0xc4 int_urx 0x88 int_sio0 0xc8 int_utx 0x8c int_sio1 0xcc int_uerr 0x90 int_iic 0xd0 int_dma0 0x94 int_rtca 0xd4 int_dma1 0x98 int_rtct 0xd8 int_tof0 0x9c int_tf 0xdc int_tmc0 0xa0 eint2 0xe0 int_tof1 0xa4 eint3 0xe4 int_tmc1 0xa8 eint4/5/6/7 0xe8 int_tof2 0xac int_adc 0xec int_tmc2 0xb0 eint8 0xf0 int_tof3 0xb4 eint9 0xf4 int_tmc3 0xb8 eint10 0xf8 int_tof4 0xbc eint11 0xfc
interrupt controller S3C3410X risc micr oprocessor 11- 10 interrupt priority register (intpri) intprin are the interrupt priority register to determine the priority of interrupt sources. there should be 32 grade priorities for interrupt sources because there are total 32 interrupt request sources in S3C3410X. it means that the 5-bit register can determine all the priorities of 32 interrupt request sources. so, each intprin is divided into four part to set the priority of the each interrupt source, that is, intpri0 is divided into priority3, priority2, priority1, and priority0. lower number has the higher priority than the higher number, that is, priority0 has the higher priority than priority3. so, for determining the priority of interrupt sources, first set the interrupt number in priorityn only. for example, if proirity0 have 0x11, which is basic timer interrupt number, then basic timer interrupt have the highest priority in all interrupt sources. as previously mentioned, there are two kinds of interrupt mode in cpu. one is fiq and the other is irq. the fiq has the higher priority than irq in cpu. so, if you want to set the priority of fiq and irq, you must set the priority of fiq higher than that of irq. in summary, the fiq must have the higher priority than irq, interrupt source in low number priority register has the higher priority than interrupt source in high number priority register. in addition, all 32 priorityn should have a different interrupt source number. register offset address r/w description reset value intpri0 0xc00c r/w interrupt priority register 0 0x03020100 intpri1 0xc010 r/w interrupt priority register 1 0x07060504 intpri2 0xc014 r/w interrupt priority register 2 0x0b0a0908 intpri3 0xc018 r/w interrupt priority register 3 0x0f0e0d0c intpri4 0xc01c r/w interrupt priority register 4 0x13121110 intpri5 0xc020 r/w interrupt priority register 5 0x17161514 intpri6 0xc024 r/w interrupt priority register 6 0x1b1a1918 intpri7 0xc028 r/w interrupt priority register 7 0x1f1e1d1c register [28:24] [20:16] [12:8] [4:0] intpri0 en priority3 x priority2 x priority1 x priority0 intpri1 x priority7 x priority6 x priority5 x priority4 intpri2 x priority11 x priority10 x priority9 x priority8 intpri3 x priority15 x priority14 x priority13 x priority12 intpri4 x priority19 x priority18 x priority17 x priority16 intpri5 x priority23 x priority22 x priority21 x priority20 intpri6 x priority27 x priority26 x priority25 x priority24 intpri7 x priority31 x priority30 x priority29 x priority28
S3C3410X risc microprocessor interrupt controller 11- 11 intpri0 bit description initial state en [31:29] 000 = disable interrupt priority other = enable interrupt priority 000 priority n 5-bit the priority number for interrupt request source n. x 3-bit do not care field. notes: 1. to use the programmable priority, set en to 000b, then the priority should be determined by sw. 2. the priorityn determines the priority of the corresponding interrupt source. 3. the highest priority is priority0, and the lowest priority is priority31.
interrupt controller S3C3410X risc micr oprocessor 11- 12 notes
S3C3410X risc microprocessor a/d converter 12- 1 12 a/d converter overview the 10-bit cmos a/d converter in S3C3410X has a 8-channel analog input multiplexer, auto offset calibration comparator, high resolution r-string dac, clock generator, successive approximation register(sar), adc control register(adccon), and tri-state output register (adcdat). this well trimmed adc architecture can give high accurate conversion result. in addition to accurate conversion result, users can have the power down mode of adc to reduce the power consumption when users do not use the adc. feature resolution: 10-bit differential linearity error: 1 lsb integral linearity error: 1 lsb maximum conversion rate: 500ksps low power consumption: 3.3 mw (typical) @ normal operation mode 330 nw (typical) @ standby mode no missing code
a/d converter s3c34 10x risc microprocessor 12- 2 a/d converter operation block diagram 8 ain[7:0] comp + - sar/adc clkgen input select /2, /4, /8, /16 mclk outreg adcdat dac int adcint data bus 10 clk1 clk2 daclk vref (internal reference voltage) figure 12-1. a/d converter block diagram function description sar (successive approximation register) a/d converter operation a sar type a/d converter basically consists of the comparator, d/a converter, and sar logic. the conversion process of basic sar-type adc is as follow. after sampling analog input, the msb is switched on to generate the d/a output of half reference voltage and the analog input signal is compared to the output signal of the d/a converter. when the input signal is larger than the output signal of the d/a converter, then the msb remains and next bit is switched on to generate the d/a output contributing quarter reference voltage. it means that there will be comparison between analog input and the 0.75 reference voltage. when the input signal is smaller than the output signal of the d/a converter, then the msb is off and next bit is switched on to generate the d/a output contributing quarter reference voltage. it means that there will be comparison between analog input and the 0.25 reference voltage. and a comparison will be performed. by having this comparison algorithm, we need 10 times comparison to determine the 10bit result. usually, sar algorithm need n-step to determine the n-bit, which has linear complexity.
S3C3410X risc microprocessor a/d conve rter 12- 3 comparator and dac (digital to analog converter) the cmos comparator can produce the digital output as the result of comparison between analog input and reference voltage by the assumed digital code. this comparator need internal non-overlapping clock to reduce the error effect during the conversion process. especially, the d/a converter consists of 128 resistor strings and switches array to cover 7-bit resolution. so, the comparator should perform the comparison with 3-bit resolution. the d/a converter can generate the digitized analog output (daout) from data of sar logic block as follows: daout = ( avref ? avss ) / 128 d[9:0] where avref and avss are analog reference voltage and analog ground which should be applied to the comparator and the d/a converter block. clock divider and clock generator (clkgen) the clock divider block of the a/d converter can generate the necessary clock for adc. the clock rate for adc can eventually indicate the conversion speed of adc. to get the reliable accuracy of adc, users should configure the proper clock rate of adc. the adc clock can be achieved by slowing down the mclk. the cksel field in adccon register can select the necessary clock for adc. these options are mclk/2, mclk/4, mclk/8, or mclk/16. internally, adc should generate the necessary clock based on master clock. for example, we need non-overlapping clock for the operation of adc. note: the maximum frequency into clkgen is 20mhz. in other word, the mclk/x should be less than 20mhz. a/d conversion time the number of cycle of clkgen (input clock of clock generator for adc) which needs for complete conversion of 10-bit resolution, is 45. so, the minimum a/d conversion time at mclk=40mhz is calculated as follows if users take the division factor of 2: 40mhz / 2 (divide 2 frequency) / 45 = 444.4khz = 2.25us if mclk is 25mhz, the minimum a/d conversion time is calculated as follows: 25mhz / 2 / 45 = 277.8khz = 3.6us note: in the above calculated a/d conversion time, the cpu access time is omitted. if the cpu access time is considered, the maximum conversion rate will be about 500ksps. standby mode when users need the reduction of power for adc, users can set the stby "1". in this case, the a/d converter should be kept in standby mode without an a/d conversion operation and it can eliminate the power consumption, also note: if stby is applied during a/d conversion, the flag bit goes high immediately.
a/d converter s3c34 10x risc microprocessor 12- 4 a/d converter special registers a/d converter control register (adccon) register offset address r/w description reset value adccon 0x8002 r/w a/d converter control register 0x140 adccon bit description initial state aden [0] a/d enable: this bit can determine enable/disable for adc. 0 = no operation 1 = start a/d conversion. this bit will be cleared automatically after conversion start. 0 asel [3:1] analog input select: this field can determine the channel of analog input. 000 = ain0 001 = ain1 010 = ain2 011 = ain3 100 = ain4 101 = ain5 110 = ain6 111 = ain7 000 clksel [5:4] clock source: this field can determine the input clock of clock generator (clkgen) 00 = mclk / 16 01 = mclk / 8 10 = mclk / 4 11 = mclk / 2 00 stby [6] standby mode: system power down mode select. 0 = normal operation 1 = power down mode 1 mode [7] conversion mode: 10-bit/8-bit mode. 0 = 10-bit operation 1 = 8-bit operation 0 flag [8] a/d converter state flag (read only) 0 = a/d conversion in process 1 = end of a/d conversion 1
S3C3410X risc microprocessor a/d conve rter 12- 5 a/d converter data register (adcdat) when a/d conversion is finished, the conversion result can be read from the adcdat register. the adcdat register should be read after the conversion is finished. register offset address r/w description reset value adcdat 0x8006 r/w a/d converter data register ? adcdat bit description initial state data [9:0] a/d converter output ? note: if mode bit in the adccon register set to "1", adcdat[1:0] isn't a valid value. instead, the maximum conversion rate will be 650ksps.
a/d converter s3c34 10x risc microprocessor 12- 6 notes
S3C3410X risc microprocessor basic timer & watchdog timer 13- 1 13 basic timer & watchdog timer overview the S3C3410X has internal basic timer/watchdog timer. this kind of timer can be used to resume the controller operation when it is disturbed due to noise, system error, or other kinds of malfunction. to have a configuration on watchdog timer, the overflow signal from 8-bit basic timer should be fed to the clock input of 3-bit watchdog timer as shown in below figure. user can enable or disable the watchdog timer by software, i.e., by controlling the configuration in btcon register. if users do not want to use the configuration of watchdog timer, the 8-bit basic timer can only be used as a normal interval timer to request the interrupt service. also, it works to signal the end of the required oscillation interval after a reset or stop mode release. for example, the basic timer can give the overflow signal to necessary logic blocks after a reset or release from stop mode. in this case, the overflow signal from basic timer can guarantee the necessary time delay for stable clock from external oscillator circuit. clock div fin / 2^9 fin / 2^11 fin / 2^12 fin / 2^13 fin 8-bit counter 3-bit wdt reset btint wdt enable control clock select counter clear counter clear bit 4 cpu start figure 13-1. basic timer block diagram
basic timer & watchdog timer S3C3410X r isc microprocessor 13- 2 function description interval timer function the primary function of basic timer is to measure the elapsed time between events. the standard time interval is equal to 256 basic timer clock pulses, which is an overflow signal from 8-bit basic timer. the content of 8-bit counter register, btcnt, increases it content every when a clock signal is detected which corresponds to the frequency selected by btcon. the btcnt continues its counting until an overflow occurs, i.e., the content reaches to 255. an overflow can cause the bt interrupt pending flag to be set, which signals that the designated time interval has elapsed. in this case, when an interrupt request is generated, btcnt is cleared to all zero, and the counting continues from 00h, again. oscillation stabilization using interval timer function users can use the basic timer to have programmable delay time, which is necessary for stabilizing the clock signal from oscillator circuit after reset or stop mode release. when the S3C3410X is in stop mode, the reset or external interrupt request can wake up the S3C3410X. please understand that the oscillator circuit is in disable state when the S3C3410X is in stop mode. in case of wake-up by reset, the oscillator should start first. because the default clock division ratio is fin / 2^13, the fin / 2^13 clock will be fed to the 8-bit basic timer. when an overflow occurs from bit 4 of btcnt register(not using 8-bit, but 4- bit of basic timer), this kind of overflow signal can release the clock blocking to cpu. in other word, the normal clock can be bed to S3C3410X when an overflow of bit 4 in basic timer. in case of wake-up by external interrupt request, the only difference from reset, is clock division ratio. while we should use the default value of clock division ratio for the case of wake-up by reset, we use the pre-defined value of clock division ration before entering stop mode for the case of wake-up by external interrupt request. in any case, the cpu can resume its operation when normal clock can be fed to the blocks in S3C3410X. in summary, please take following sequence for releasing S3C3410X from stop mode: 1. when S3C3410X is in stop mode, the escape fr om stop mode can be made by a power-on reset or an external interrupt. at same time, the oscillator can start its oscillation. 2. in case of wake-up by power-on reset, the basic timer will increase its content(btcnt) at the rate of fin / 2^13, which is the default rate of clock division ration. in case of wake-up by external interrupt request, the basic timer will increase its content(btcnt) at the rate of preset value, which is written before entering into stop mode. 3. the normal clock from oscillator will be delayed to be fed to all logic blocks inside S3C3410X until the 4 th bit of basic timer is generated. it means that user can use the basic timer to guarantee the stable clock from oscillator, i.e., waiting up to stable oscillation. 4. when the normal clock can be fed to S3C3410X, the S3C3410X can resume the operation.
S3C3410X risc microprocessor basic time r & watchdog timer 13- 3 watchdog timer operation the basic timer can also be used as a "watchdog" timer to recover the S3C3410X from the unexpected program sequence, that is, system or program operation error due to external factor. for example, the external noise can cause this kind of situation, which means that the cpu is running the unexpected code sequence, i.e., malfunction of cpu. to recover the cpu from the unexpected sequence, the watchdog timer should reset the cpu in case of malfunction. but, during normal sequence, the instruction which clear the watchdog before the overflow of watchdog timer (within a given period) should be executed at the proper points in a program. if this instruction can be executed in certain circumstance, it means the overflow of watchdog timer and it can generate the internal reset signal generation to restart the cpu from the beginning. in summary, an operation of watchdog timer is as follows: each time btcnt overflows, an overflow signal should be sent to the watchdog timer counter, wdtcnt. if wdtcnt overflows, system reset should be generated. note a reset signal can clear the btcon as 0x0000. this value can enable the watchdog timer because it is not 0xa5(please understand the watchdog timer can be disable when its content(wdte field in btcon[15:8] register) is 0xa5). for normal program sequence, the application program should prevent the overflow. to do this, the wdtcnt value should be cleared(by writing a "1" to wdtc bit of the basic timer control register(btcon[0])) before the overflow occurs.
basic timer & watchdog timer S3C3410X r isc microprocessor 13- 4 basic timer duration the basic timer counter, btcnt, can be used to specify the time-out duration, and is a free-running 8-bit counter. please keep below table as reference for duration of timer. this is the case when the external clock is 40mhz. clock source resolution interval time fin / 2 9 (fin = 40mhz) 12.8 us 2^9 2 8 / fin = 3.277 ms fin / 2 11 (fin = 40mhz) 51.2 us 2 11 2 8 / fin = 13.107 ms fin / 2 12 (fin = 40mhz) 102.4 us 2 12 2 8 / fin = 26.214 ms fin / 2 13 (fin = 40mhz) 204.8 us 2 13 2 8 / fin = 52.429 ms watchdog timer duration the watchdog timer counter, wtcnt, can be used to specify the time-out duration and is a free-running 3-bit counter. to enable watchdog timer, user should write the data in btcon[15:8] register except 0xa5. in case of 0xa5, it will disable the watchdog timer. after writing certain value in btcon[15:8] except 0xa5, there will be a system reset if the overflow occurs. clock source basic timer interval watchdog timer interval time fin / 2 9 (fin = 40mhz) 3.277 ms 2 9 2 8 2 3 / fin = 26.214 ms fin / 2 11 (fin = 40mhz) 13.107 ms 2 11 2 8 2 3 / fin = 104.858 ms fin / 2 12 (fin = 40mhz) 26.214 ms 2 12 2 8 2 3 / fin = 209.715 ms fin / 2 13 (fin = 40mhz) 52.429 ms 2 13 2 8 2 3 / fin = 419.430 ms
S3C3410X risc microprocessor basic time r & watchdog timer 13- 5 basic timer & watchdog timer special registers basic timer control register (btcon) the basic timer control register contains watchdog counter enable bits, clock input bits, and counter clear bit. register offset address r/w description reset value btcon 0xa002 r/w basic timer control register 0x0 btcon bit description initial state wdtc [0] watchdog timer clear: this bit can clear the watchdog timer counter. when this bit is set, the watchdog timer counter will be cleared to all zero. 0 btc [1] basic timer clear: this bit can clear the basic timer counter. when this bit set, the basic timer counter will be cleared to all zero. 0 cs [3:2] clock source select: this field can select a clock source. 00 = fin / 2 13 01 = fin / 2 12 10 = fin / 2 11 11 = fin / 2 9 00 reserved [7:4] reserved 0000 wdte [15:8] watchdog timer enable: this field can control to enable or disable a watchdog timer counter. when this field is 0xa5, watchdog timer counter will be stopped. the other value except 0xa5 can enable a watchdog timer counter, and make a system reset when the overflow signal occurs. 00000000 basic timer count register (btcnt) register offset address r/w description reset value btcnt 0xa007 r basic timer count register 0x0 btcnt bit description initial state cv [7:0] count value 0x00
basic timer & watchdog timer S3C3410X r isc microprocessor 13- 6 notes
S3C3410X risc microprocessor iic-bus interface 14- 1 14 iic-bus interface overview the S3C3410X risc microprocessor can support a multi-master iic-bus serial interface. a dedicated serial data line(sda) and a serial clock line(scl) can carry information between bus masters and peripheral devices which are connected to the iic-bus. the sda and scl lines are bi-directional. in multi-master iic-bus mode, multiple S3C3410X risc microprocessor can receive or transmit the serial data to or from slave devices. the master S3C3410X which can initiate a data transfer over the iic-bus, is responsible for terminating the transfer. standard bus arbitration procedure is used in this iic-bus in S3C3410X. when the iic-bus is free, the sda and scl lines should be both at high level. a high-to-low transition of sda can initiate a start condition. a low-to-high transition of sda can initiate a stop condition while scl remains steady at high level. the start and stop conditions can always be generated by the master devices. a 7-bit address value in the first data byte which is put onto the bus after the start condition is initiated, can determine the slave device which the bus master device has selected. the 8 th bit determines the direction of the transfer (read or write). every data byte that is put onto the sda line should be total eight bits. the number of bytes which can be sent or received during the bus transfer operation is unlimited. data is always sent from most-significant bit (msb) first and every byte should be immediately followed by an acknowledge (ack) bit. serial clock prescaler scl control iic-bus control logic iiccon iicstat iicdat iicadd data control mclk iicint scl sda figure 14-1. iic-bus block diagram
iic-bus interface s 3c3410x risc microprocessor 14- 2 iic_bus operation the iic-bus interface the S3C3410X iic-bus interface has four operation modes: ? master transmitter mode ? master receive mode ? slave transmitter mode ? slave receive mode functional relationships among these operating modes are described below. start and stop conditions when the iic-bus interface is in inactive state, it is usually in slave mode. in other word, the state of interface should be in slave mode before detecting a start condition on the sda line. (a start condition can be initiated by having a high-to-low transition of the sda line while the clock signal of scl is high) when the state of interface is changed into the master mode, it can initiate a data transfer on the sda line as well as generating the scl signal. a start condition can initiate a one-byte serial data transfer over the sda line and stop condition can indicate the termination of data transfer. a stop condition is a low-to-high transition of the sda line while scl is high. start and stop conditions are always generated by the master. the iic-bus is busy when a start condition is generated. a few clocks after a stop condition, the iic-bus will be free, again. when a master initiates a start condition, it should send slaver address to give a notice to the slaver device. the one byte of address field consist of a 7-bit address and a 1-bit transfer direction indicator (that is, write or read). if bit 8 is 0, it indicate a write operation(transmit operation). if bit 8 is 1, it indicate a request for data read(receive operation). the master will finish the transfer operation by transmitting a stop condition. if the master want to continue the data transmission the bus, it should generate another start condition as well as slave address. in this way, the read-write operation can be performed in various format. scl sda sda scl start condition stop condition figure 14-2. start and stop condition
S3C3410X risc microprocessor iic-bus in terface 14- 3 data transfer format every byte put on the sda line should have eight bits in length. the number of bytes which can be transmitted per transfer is unlimited. the first byte following a start condition should have the address field. the address field can be transmitted by the master when the iic-bus is operating in master mode. each byte should be followed by an acknowledge (ack) bit. the msb bit of serial data and addresses are always sent first. notes: 1. s: start, rs: repeat start, p: stop, a: acknowledge 2. : from master to slave, : from slave to master write mode format with 7-bit addresses "0" (write) data transferred (data + acknowledge) s slave address 7bits r/w a p data a read mode format with 7-bit addresses "1" (read) data transferred (data + acknowledge) s slave address 7 bits r/w a p data a write mode format with 10-bit addresses "0" (write) data transferred (data + acknowledge) p data a s slave address 1st 7 bits r/w a slave address 2nd byte a 11110xx read mode format with 10-bit addresses "0" (write) s slave address 1st 7 bits 11110xx r/w a slave address 2nd byte a rs slave address 1st 7 bits a data transferred (data + acknowledge) p data a r/w "1" (read) figure 14-3. iic-bus interface data format
iic-bus interface s 3c3410x risc microprocessor 14- 4 sda acknowledgement signal from receiver scl s 1 2 7 8 9 1 2 9 acknowledgement signal from receiver msb ack byte complete, interrupt within receiver clock line held low while interrupts are serviced p figure 14-4. data transfer on the iic-bus ack signal transmission to finish a one-byte transfer operation completely, the receiver should send an ack bit to the transmitter. the ack pulse should occur at the ninth clock of the scl line. eight clocks are required for the one-byte data transfer. the clock pulse required for the transmission of the ack bit, should be generated by the master. the transmitter should release the sda line by making the sda line high when the ack clock pulse is received. the receiver should also drive the sda line low during the ack clock pulse so that the sda is low during the high period of the ninth scl pulse. the ack bit transmit function can be enable or disable by software (iicstat). however, the ack pulse on the ninth clock of scl is required to complete a one-byte data transfer operation. data output by trasmitter data output by receiver scl from master start condition clock pulse for acknowledgment clock to output 9 8 7 s 1 2 figure 14-5. acknowledge on the iic-bus
S3C3410X risc microprocessor iic-bus in terface 14- 5 read-write operation in case of transmitter mode, after a data was transferred, the iic-bus interface will wait until iicds(iic-bus data shift register) is written by a new date. until the new data is written, the scl line will be held low. after the new data is written to iicds register, the scl line will be released. the S3C3410X should wait the interrupt to know the completion of transmission of current data. after getting the interrupt request, the cpu should write a new data into iicds, again. in case of receive mode, after a data is received, the iic-bus interface will wait until iicds register is read. until the new data is read out, the scl line will be held low. after the new data is read out from iicds register, the scl line will be released. the S3C3410X should wait the interrupt to know the completion of reception of new data. after getting the interrupt request, the cpu should read data from iicds. bus arbitration procedures arbitration takes place on the sda line to prevent the contention on the bus between two masters. if a master with a sda high level detects another master with a sda active low level, it will not indicate a data transfer because the current level on the bus does not correspond to its own. the arbitration procedure will be extended until the sda line will be high. but, in case of simultaneous lowering of the sda line from masters, each master should evaluate whether or not the mastership is allocated to itself. for the purpose of evaluation, each master should detect the address bits. while each master generate the slaver address, it should also detect the address bit on the sda line because the lowering of sda line is stronger than maintaining high on the line. for example, one master generate low as first address bit, while the other master is maintaining high. in this case, both master will be detect low on the bus because low is stronger than high even if first master is trying to maintain high on the line. in this case, low- generating master as first address bit will get the mastership and high-generating master as first address bit should withdraw the mastership. if both master generate low as first address bit, there should be arbitration for second address bit, again. this arbitration will be continued up to the end of last address bit. abort condition if a slave receiver can not acknowledge the confirmation of the slave address, it should hold the level of the sda line high. in this case, the master should generate a stop condition to abort the transfer. if a master receiver is involved in the aborted transfer, it should signal the end of the slave transmit operation. it does this by canceling the generation of an ack in the master rx mode. the slave transmitter should then release the sda to allow a master to generate a stop condition.
iic-bus interface s 3c3410x risc microprocessor 14- 6 iic-bus interface special registers multi-master iic-bus control register (iiccon) register offset address r/w description reset value iiccon 0xe000 r/w iic-bus control register 0x0 iiccon bit description initial state reserved [0] reserved 0 bssf [1] busy signal status flag: when cpu has read this bit, the "0" status indicates that iic-bus is idle and the "1" status means iic- bus is busy. in case of writing to this bit, the "0" write operation asserts the stop signal on iic-bus interface and the "1" asserts the start signal on iic-bus interface. 0 ms [3:2] mode selection: this field determines which iic mode is currently able to read/write data from/to iicdat 00 = slave receive mode 01 = slave transmit mode 10 = master receive mode 11 = master transmit mode 00 acke (1) [4] acknowledge enable: this bit determines whether iic-bus acknowledge is enabled or disabled. 0 = disable ack generation 1 = enable ack generation 0 be [5] iic-bus enable: this bit determines whether iic-bus data output is enabled or disabled. 0 = disable rx/tx 1 = enable rx/tx 0 reserved [6] this bit should be to set "0" 0 reset [7] if "1" is written to this bit, the iic bus controller is reset to its initial state 0 note: interfacing eeprom, the ack generation may be disabled in order to generate the stop condition in rx mode.
S3C3410X risc microprocessor iic-bus in terface 14- 7 multi-master iic-bus status register (iicstat) register offset address r/w description reset value iicstat 0xe001 r/w iic-bus status register 0x0 iicstat bit description initial state lrbsf [0] last-received bit status flag: this bit is automatically set to "1" whenever an ack signal is not received during a last bit receive operation. when the last receive bit is zero, this is as same meaning as the detection of an ack signal. in this case, last-received bit status flag will be cleared. 0 gcsf [1] general call status flag: this bit is automatically set to "1" whenever "00000000b", general call value is issued as the received slave address. when the start/stop condition is detected, this bit of general call status flag will be cleared. 0 macsf [2] master address call status flag: this bit is automatically set to "1" whenever the received slave address matches the address value in iicadd register. this bit will be cleared after start/stop condition is detected. 0 asf [3] arbitration status flag: this bit is automatically set to "1" to indicate that a bus arbitration has been failed during iic-bus interface. this bit is also set to "0" to indicate the successful arbitration for iic-bus interface 0 intflag [4] interrupt pending flag: this bit is iic-bus tx/rx interrupt pending flag. it is impossible to write "1" into this bit. if this bit is read as "1", iicscl is tied to "l" and iic is stopped. to resume the operation, clear this bit by writing "0". 0 = 1) no interrupt pending (when read) 2) clear pending condition (when write) 1 = 1) interrupt is pending (when read) 2) n/a (when write) 0 note: a iic-bus interrupt occurs 1) when a 1-byte transmit or receive operation is terminated, 2) when a general call or a slave address match occurs, or 3) if bus arbitration fails. to measure the setup time of iicsda before rising edge of iicscl, iicds has to be written before clearing iic interrupt pending flag bit by the setup time in tx mode.
iic-bus interface s 3c3410x risc microprocessor 14- 8 multi-master iic-bus address register (iicadd) register address r/w description reset value iicadd 0xe003 r/w iic-bus transmit/receive address register 0x0 iicadd bit description initial state reserved [0] reserved 0 sa [7:1] slave address: 7-bit slave address, latched from the iic-bus: when serial output enable=0 in the iiccon register, iicadd is write-enabled. you can read the iicadd value at any time, regardless of the current serial output enable bit (iiccon) setting. 0000000b multi-master iic-bus transmit/receive data shift register (iicds) register address r/w description reset value iicds 0xe002 r/w iic-bus transmit/receive data shift register 0x0 iicds bit description initial state ds [7:0] data shift: 8-bit data shift register for iic-bus tx/rx operation: when serial output enable = 1 in the iiccon, iicds is write- enabled. you can read the iicds value at any time, regardless of the current serial output enable bit (iiccon) setting 0x0
S3C3410X risc microprocessor iic-bus in terface 14- 9 multi-master iic-bus prescaler register (iicps) register address r/w description reset value iicps 0xe004 r/w iic-bus prescaler register 0xff iicps bit size description initial state ps [7:0] prescaler value: this prescaler value is used to generate clock of the iic-bus clock. the system clock is divided by (16 (prescaler value +1)) to make clock of the iic block. if the prescaler value is zero, iic operation may work incorrectly. 0xff multi-master iic-bus prescaler counter register (iicpcnt) register address r/w description reset value iicpcnt 0xe005 r/w iic-bus prescaler counter register 0x0 iicpcnt bit description initial state pcnt [7:0] prescaler counter value: this 8-bit value is the value of the prescaler counter. it is read(in test mode only) to check the counter's current value 0x0
iic-bus interface s 3c3410x risc microprocessor 14- 10 notes
S3C3410X risc microprocessor power management 15- 1 15 power management overview the power management block in S3C3410X can manage the optimal power consumption for the given task by selecting the optimal operation mode. the power management scheme in S3C3410X consists of five categories, which are normal, slow, idle, dma idle, and stop mode. the key scheme of this power down mode is to distribute the clock or slow-down clock to necessary block for the given task. by selecting optimal clocking strategy, we can reduce the power consumption by getting rid of unnecessary power consumption for the given task. S3C3410X has five power-down modes. the following section describes each power-down mode. the transition between the modes is not allowed freely. for available transitions among these modes, refer to figure 15-1. dma idle idle stop normal (cs_bit=011b) slow (cs_bit=others) eint, alarm interrupt interrupts, eint idle_bit = 1 dma_idle_bit = 1 interrupts, eint stop_bit = 1 figure 15-1. power management state machine
power management S3C3410X risc microprocessor 15- 2 power management operation normal mode in normal mode, all peripherals and the basic blocks: such as cpu core, bus controller, memory controller, interrupt controller, and clock controller, should work normally. in normal mode, the power consumption will be maximized. slow mode the slow mode can reduce power consumption by slowing down operation frequency. the operating frequency is divide by n of mclk. the divide ratio is determined by cs bits in the syscon register. idle mode idle mode is invoked by the setting syscon[1] to "1". in idle mode, the operation of cpu is halted by disconnecting the clock to cpu while some peripherals remain active. these are two ways to escape from idle mode: 1. execute a reset. all system and peripheral control registers are reset to their default value and the contents of all data registers are retained. the reset automatically selects a slow clock (1/16) because syscon[5:3] are cleared to "000b". if interrupt masked, a reset is the only way to escape from idle mode. 2. any active interrupt happens, causing idle mode to be released. the interrupt routine will be serviced by active cpu. after the interrupt is serviced, the cpu will return to the next instruction after instruction used for idle mode entrance. dma idle mode the dma idle mode can be invoked by the setting syscon[2] to "1". in dma idle mode, cpu operation will be stopped while some peripherals remain active. this is same as idle mode. the difference between idle and dma idle mode is that any external dma request can wake up cpu and make cpu sleep by the corresponding dma acknowledge. consequently, user can make cpu alive only during the dma operation. this mode is effective when there are infrequent external dma request based on single dma request/acknowledge. this mode is not effective for internal dma request, demand, or block transfer mode. the main reason for this mode is that we can save the power consumption during dma operation by sleeping cpu when user want dma operation without cpu operation and when there are infrequent external dma request. these are three ways to release dma idle mode: 1. execute a reset. it is the same that idle mode. 2. any active interrupt happens, causing dma idle mode to be released. it is as same as idle mode. 3. the external dma request makes dma idle mode to be released and acknowledge makes cpu in idle mode.
S3C3410X risc microprocessor power mana gement 15- 3 stop mode entering stop mode stop mode is invoked by the setting syscon[0] to "1". in stop mode, the operation of the cpu and all peripherals should be halted. that is, the on-chip main oscillator stops and the supply current is reduced to less than 1ua. all system functions stop when the clock "freezes", but data stored in the internal register file is retained. stop mode can be released by two ways: by a reset or by an external interrupt or alarm interrupt. note do not use stop mode if you are using an external clock source because xin input must be restricted internal to vss to reduce current leakage. also, do not use stop mode if program control execute in dram memory because of dram leakage current. therefore, please confirm status before the stop mode: stop command in located non-dram memory. wake-up from stop mode the S3C3410X can be escaped from stop mode by external interrupt or by a reset. using reset reset to release stop mode: the stop mode should be released when the reset signal is released. all system and peripheral control registers are reset to have their default hardware values and the contents of data registers should be retained. a reset operation automatically selects a slow clock(mclk/16) because syscon[5:3] are cleared to "000b". after the programmed oscillation stabilization interval has elapsed, the cpu starts the system initialization routine by fetching the program instruction stored in location 0x0. using an external interrupt to release stop mode: external interrupts and alarm interrupt can be used to release stop mode. which interrupt you can use to release stop mode in a given situation depends on the current microcontroller's operating mode. the external interrupts of eint0 - eint11 and alarm interrupt in the S3C3410X can be used to release stop mode : please note the following conditions for stop mode release: if user want to release stop mode by using an external interrupt or alarm interrupt, the current values in system and peripheral control registers should be unchanged. user can also program the duration of the oscillation stabilization interval. to do this, user should make the appropriate control and clock setting before entering stop mode. when the stop mode is released by external interrupt or alarm interrupt, the syscon[5:3] setting remains unchanged and the selected clock value is used. the external interrupt should be serviced when the stop mode release interrupt occurs. after interrupt service routine, the program sequence should be return to the instruction after the instruction for stop mode entrance.
power management S3C3410X risc microprocessor 15- 4 v dd reset internal reset oscillator btcnt clock btcnt value btcnt = 0x10 oscillator stabilization time btcnt = 0x0 reset release voltage 0.85vdd oscillation stabilization normal operation mode twait = 8192 16 / fosc basic timer increament and cpu operations are idle mode figure 15-2. oscillation stabilization time on reset reset note: duration of the stabilization wait time, twait, when it is released by a power-on reset is (2 13 16 / fosc).
S3C3410X risc microprocessor power mana gement 15- 5 external interrupt reset oscillator btcnt clock btcnt value btcnt = 0x10 btcnt = 0x0 twait normal mode stop mode oscillation stabilization time cs_bit 00b 01b 10b 11b twait twait (when fosc is 40mhz) 2 13 16 / fosc 3.28 ms 2 12 16 / fosc 1.64 ms 2 11 16 / fosc 0.82 ms 2 9 16 / fosc 0.205 ms figure 15-3. oscillation stabilization time on stop mode release note: duration of the stabilization wait time, twait, it is released by an interrupt is determined by the setting in basic timer control register, btcnt
power management S3C3410X risc microprocessor 15- 6 power management special function registers system control register (syscon) the system control register is used to control the system operation of the chip. register offset address r/w description reset value syscon 0xd003 r/w system control register 0x0 syscon bit description initial state stop [0] stop control: this bit value determines whether stop mode is enabled or disabled. 0 = normal operation 1 = entering stop mode 0 idle [1] idle control: this bit value determines whether idle mode is enabled or disabled. 0 = normal operation 1 = entering idle mode 0 dma_idle [2] dma idle control: this bit value determines whether dma_idle mode is enabled or disable. 0 = normal operation 1 = entering dma_idle mode 0 cs [5:3] clock select: this field determines frequency of system clock. 000 = mclk / 16 001 = mclk / 8 010 = mclk / 2 011 = mclk 100 = mclk / 1024 000 gie [6] global interrupt enable: this bit control to enable or disable the interrupt 0 = no requested 1 = requested 0
S3C3410X risc microprocessor real time clock 16- 1 16 rtc (real time clock) overview the rtc(real time clock) unit can be operated by the backup battery although the system power is turned off. the rtc can transmit 8-bit data to cpu as bcd(binary coded decimal) values using strb/ldrb arm operation. the data include second, minute, hour, date, day, month, and year. the rtc unit works with an external 32.768khz crystal and also can perform the alarm function feature bcd number: second, minute, hour, date, day, month, year leap year generator alarm function: alarm interrupt. year 2000 problem is removed. independent power pin (rtcvdd) rtc time interrupt (sec/min/hour) real time clock operation system bus extal1 xtal1 osc & frequency division logic sec min hour day date mon year rtccon alarm generator leap year generator int_rtct int_rtca figure 16-1. real time clock block diagram
real time clock s3c 3410x risc microprocessor 16- 2 leap year generator this block can determine whether the last date of each month is 28, 29, 30, or 31, based on data from bcdday, bcdmon, and bcdyear. this block can also consider the leap year in deciding the last date. an 8-bit counter can only represent 2 bcd digits, so it cannot decide whether 00 year is a leap year or not. for example, it can not discriminate between 1900 and 2000. to solve this problem, the rtc block in S3C3410X has hard-wired logic to support the leap year in 2000. please note 1900 is not leap year while 2000 is leap year. therefore, two digits of 00 in S3C3410X denote 2000, not 1900. safe read of sec, min, hour, day, month, and year it is required to set bit 0 of the rtccon register to read and write the register in rtc block. to display the sec., min., hour, day, month, and year, the cpu should read the data in bcdsec, bcdmin, bcdhour, bcdday, bcddate, bcdmon, and bcdyear register in rtc block. but, there may be one second deviation because of multiple register read. for example, when user read registers from bcdyear to bcdmin register, we assume that the result was 1959(year), 12(month), 31(date), 23(hour) and 59(minute). when user read bcdsec register, if the result is value from 1 to 59(second), there is no problem. but, if the result is 0 sec., there will be possibility for year, month, data, hour, and minute to be changed into 1960(year), 1(month), 1(date), 0(hour) and 0(minute) because of one second deviation as above-mentioned. in this case, user should read from bcdyear to bcdsec again if bcdsec is zero. backup battery operation the rtc logic can be driven by the backup battery, which supplies the power through the rtcvdd pin into rtc block, even if the system power is off. in this case of power-off, the interfaces of the cpu and rtc logic should be blocked and the backup battery only drives the oscillation circuit and the bcd counters to minimize power dissipation. alarm function the rtc can generate an alarm signal at a specified time in the power down mode or normal operation mode. in normal operation mode, the alarm interrupt (int_rtca) is activated. the rtc alarm register, rtcalm, can determine the alarm enable/disable and the condition of the alarm time setting. rtc timer interrupt operation the rtc generates an time interrupt at each sec/minute/hour/day in normal operation mode. in normal operation mode, the rtc time interrupt (int_rtct) is activated. the rtc time interrupt control register, rintcon, determines the rtc time (sec/min/hour/day) interrupt enable.
S3C3410X risc microprocessor real time clock 16- 3 real time clock special registers real time clock control register (rtccon) the rtccon register consists of 4 bits such as rtcen which controls the read/write enable of the bcd registers, clksel, cntsel, and clkrst for testing. rtcen bit can control all interfaces between the cpu and the rtc, so it should be set to 1 in an rtc control routine to enable data read/write after a system reset. also before power off, the rtcen bit should be cleared to 0 to prevent an inadvertent writing into rtc registers. register offset address r/w description reset value rtccon 0xa013 r/w rtc control register 0x0 rtccon bit description initial state rtcen [0] rtc read/write enable 0 = disable, 1 = enable 0 clksel [1] bcd clock select 0 = xtal 1/2 15 divided clock 1 = reserved (xtal clock) 0 cntsel [2] bcd count select 0 = merge bcd counters 1 = reserved (separate bcd counters) 0 clkrst [3] rtc clock count reset 0 = no reset, 1 = reset 0
real time clock s3c 3410x risc microprocessor 16- 4 rtc alarm control register (rtcalm) rtcalm register can determine the alarm enable/disable and the alarm time. note that the rtcalm register can generate the alarm signal through int_rtca. register offset address r/w description reset value rtcalm 0xa012 r/w rtc alarm control register 0x0 rtcalm bit description initial state secen [0] second alarm enable 0 = disable, 1 = enable 0 minen [1] minute alarm enable 0 = disable, 1 = enable 0 houren [2] hour alarm enable 0 = disable, 1 = enable 0 dayen [3] day alarm enable 0 = disable, 1 = enable 0 monren [4] month alarm enable 0 = disable, 1 = enable 0 yearen [5] year alarm enable 0 = disable, 1 = enable 0 almen [6] alarm global enable 0 = disable, 1 = enable 0
S3C3410X risc microprocessor real time clock 16- 5 alarm second data register (almsec) register offset address r/w description reset value almsec 0xa033 r/w alarm second data register 0x59 almsec bit description initial state secdata [6:4] bcd value for alarm second from 0 to 5 101 [3:0] from 0 to 9 1001 alarm min data register (almmin) register offset address r/w description reset value almmin 0xa032 r/w alarm minute data register 0x59 almmin bit description initial state mindata [6:4] bcd value for alarm minute from 0 to 5 101 [3:0] from 0 to 9 1001 alarm hour data register (almhour) register offset address r/w description reset value almhour 0xa031 r/w alarm hour data register 0x23 almhour bit description initial state hourdata [5:4] bcd value for alarm hour from 0 to 2 10 [3:0] from 0 to 9 0011
real time clock s3c 3410x risc microprocessor 16- 6 alarm day data register (almday) register offset address r/w description reset value almday 0xa037 r/w alarm day data register 0x31 almday bit description initial state daydata [5:4] bcd value for alarm day, from 0 to 28, 29, 30, 31 from 0 to 3 11 [3:0] from 0 to 9 0001 alarm mon data register (almmon) register offset address r/w description reset value almmon 0xa036 r/w alarm month data register 0x12 almmon bit description initial state mondata [4] bcd value for alarm month from 0 to 1 1 [3:0] from 0 to 9 0010 alarm year data register (almyear) register offset address r/w description reset value almyear 0xa035 r/w alarm year data register 0x99 almyear bit description initial state yeardata [7:0] bcd value for year from 00 to 99 0x99
S3C3410X risc microprocessor real time clock 16- 7 bcd second register (bcdsec) register offset address r/w description reset value bcdsec 0xa023 r/w bcd second register undef. bcdsec bit description initial state secdata [6:4] bcd value for second from 0 to 5 ? [3:0] from 0 to 9 ? bcd minute register (bcdmin) register offset address r/w description reset value bcdmin 0xa022 r/w bcd minute register undef. bcdmin bit description initial state mindata [6:4] bcd value for minute from 0 to 5 ? [3:0] from 0 to 9 ? bcd hour register (bcdhour) register offset address r/w description reset value bcdhour 0xa021 r/w bcd hour register undef. bcdhour bit description initial state hourdata [5:4] bcd value for hour from 0 to 2 ? [3:0] from 0 to 9 ?
real time clock s3c 3410x risc microprocessor 16- 8 bcd day register (bcdday) register offset address r/w description reset value bcdday 0xa027 r/w bcd day register undef. bcdday bit description initial state daydata [5:4] bcd value for hour from 0 to 3 ? [3:0] from 0 to 9 ? bcd date register (bcddate) register offset address r/w description reset value bcddate 0xa020 r/w bcd date register undef. bcddate bit description initial state datedata [2:0] bcd value for date from 1 to 7 ? bcd month register (bcdmon) register offset address r/w description reset value bcdmon 0xa026 r/w bcd month register undef. bcdmon bit description initial state mondata [4] bcd value for month from 0 to 1 ? [3:0] from 0 to 9 ?
S3C3410X risc microprocessor real time clock 16- 9 bcd year register (bcdyear) register offset address r/w description reset value bcdyear 0xa025 r/w bcd year register undef. bcdmon bit description initial state yeardata [7:0] bcd value for year from 00 to 99 ?
real time clock s3c 3410x risc microprocessor 16- 10 rtc time interrupt pending register (rintpnd) register offset address r/w description reset value rintpnd 0xa010 r/w rtc time interrupt pending register 0x0 rintpnd bit description initial state int_sec [0] 0 = no interrupt pending 0 = clear interrupt pending condition (when write) 1 = rtc sec interrupt is pending 0 int_min [1] 0 = no interrupt pending 0 = clear interrupt pending condition (when write) 1 = rtc min interrupt is pending 0 int_hour [2] 0 = no interrupt pending 0 = clear interrupt pending condition (when write) 1 = rtc hour interrupt is pending 0 int_day [3] 0 = no interrupt pending 0 = clear interrupt pending condition (when write) 1 = rtc day interrupt is pending 0 rtc time interrupt control register (rintcon) register offset address r/w description reset value rintcon 0xa011 r/w rtc time interrupt control register 0x0 rintcon bit description initial state int_sec [0] setting rtc time interrupt enable of sec 0 = disable 1 = enable 0 int_min [1] setting rtc time interrupt enable of min 0 = disable 1 = enable 0 int_hour [2] setting rtc time interrupt enable of hour 0 = disable 1 = enable 0 int_day [3] setting rtc time interrupt enable of day 0 = disable 1 = enable 0
S3C3410X risc microprocessor electrical data 17- 1 17 electrical data absolute maximum ratings table 17-1. absolute maximum rating symbol parameter rating unit v dd dc supply voltage ? 0.3 to 3.8 v v in dc input voltage ? 0.3 to v dd + 0.3 v i in dc input current 10 ma t a operating temperature 0 to 70 o c t stg storage temperature ? 40 to 125 o c rtcv dd battery voltage for rtc 2.5 to v dd v
electrical data s3c 3410x risc microprocessor 17- 2 d.c. electrical characteristics table 17-2. dc electrical characteristics (v dd = 3.3 0.3v, t a = 0 to 70 o c) symbol parameters conditions min type max unit v ih high level input voltage v lvcmos interface 2.0 schmitt-trigger interface 2.3 reset v dd 0.8 xtal, extal v dd ? 0.3 v il low level input voltage v lvcmos interface 0.8 schmitt-trigger interface 0.8 reset v dd 0.2 xtal, extal 0.4 vt switching threshold lvcmos 1.4 v vt+ schmitt trigger, positive-going threshold lvcoms 2.3 v vt- schmitt trigger, negative-going threshold lvcmos 0.8 v i ih high level input current ua input buffer v in = v dd ?10 10 input buffer with pull-up 10 60 90 i il low level input current ua input buffer v in = v ss ?10 10 input buffer with pull-up ?90 -60 ?10 v oh high level output voltage v type b4, b8 (1) i oh = -1 ua v dd ? 0.05 type b4 i oh = -4 ma 2.4 type b8 i oh = -8 ma 2.4 v ol low level output voltage v type b4, b8 (1) i oh = 1 ua 0.05 type b4 i oh = 4 ma 0.4 type b8 i oh = 8 ma 0.4 i oz tri-state output leakage current v out =v ss or v dd ?10 10 ua i os output short circuit current v dd =3.6v, v o =v dd 210 ma v dd =3.6v, v o =v ss ?170 ma c in input capacitance (2) any input and bi- directional buffers 4 pf c out output capacitance (2) any output buffer 4 pf notes: 1. type b4 means 4ma output driver cell, and type b8 means 8ma output driver cells. 2. this value exclude s package parasitic.
S3C3410X risc microprocessor electrical data 17- 3 typical quiescent supply current on vdd @ normal mode test condition 1 : cache off, write buffer off, and rom access 10 mhz 20 mhz 30mhz 40mhz 3.0 v 9.06 16.52 23.62 32.96 3.3 v 10.40 18.72 27.38 37.46 3.6 v 11.80 20.96 31.06 42.24 test condition 2 : cache on, write buffer on, and cache hit operation at sdram interface 10 mhz 20 mhz 30mhz 40mhz 3.0 v 14.74 27.12 39.68 54.24 3.3 v 16.72 30.66 45.58 61.54 3.6 v 18.90 34.38 51.42 69.18 test condition 3 : cache on, write buffer on, and dma transfer(sdram to sdram, half-word transfer mode) 10 mhz 20 mhz 30mhz 40mhz 3.0 v 22.0 42.0 62.0 84.0 3.3 v 25.0 47.0 70.0 94.0 3.6 v 28.0 53.0 79.0 104.0 typical quiescent supply current on vdd @ idle mode 10 mhz 20 mhz 30mhz 40mhz 3.0 v 3.26 4.78 6.16 9.64 3.3 v 3.94 5.54 7.78 11.30 3.6 v 4.62 6.44 9.28 13.14 typical quiescent supply current on vdd @ stop mode 10 mhz 20 mhz 30mhz 40mhz 3.0 v 14 ua 3.3 v 15 ua 3.6 v 16 ua
electrical data s3c 3410x risc microprocessor 17- 4 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 0 10 20 30 40 50 spec. guaranteed area figure 17-1. typical operating voltage range
S3C3410X risc microprocessor electrical data 17- 5 a.c. electrical characteristics txtalcyc 1/2 vdd 1/2 vdd figure 17-2. extal0 clock timing tsclkdly xin (extal0) sclk figure 17-3. xin(extal0)/sclk timing
electrical data s3c 3410x risc microprocessor 17- 6 twbed trds trds sclk a[23:0] ncs noe nwbe tad tcsd toed twbed data (write) data (read) tad tcsd toed trdh twdd trdh twed nwe twed figure 17-4. rom/sram bus timing
S3C3410X risc microprocessor electrical data 17- 7 sclk a[23:0] nras noe/ nwbe0 tdrasd toed/twed data (write) data (read) tdad tdrasd toed/twed tpdrdh tpdrdh ncas tdcasd tdad tdad tdcasd tdcasd tdcasd data (read) tedrdh tedrdh tdwdd tdwdd tdwdd figure 17-5. dram (fast page/edo) bus timing sclk nras ncas tdrasd tdcasd tdrasd tdcasd figure 17-6. dram cbr refresh timing
electrical data s3c 3410x risc microprocessor 17- 8 da db dc dd de ca cb cc cd ce ra ra ba ba ba ba ba ba ba sclk scke nscs nsras nscas addr ba a10/ap nwe data (cl=2) dqm tscsd trasd tcasd tsad tbad tapd tsdwed tdqmd tsdrh tsdwd figure 17-7. sdram bus timing (single write and burst read)
S3C3410X risc microprocessor electrical data 17- 9 sclk ndreq ndack tdreqh tdackd figure 17-8. external dma timing iicscl iicsda tstoph tbuf tstarts tsdas tsdah tsclhigh tscllow tscl figure 17-9. iic interface timing
electrical data s3c 3410x risc microprocessor 17- 10 table 17-3. clock timing (v dd = 3.3 0.3v, t a = 0 to 70 o c, operating frequency = 40 mhz) parameter symbol min typ max unit crystal clock input frequency fxtal 40 mhz crystal clock input cycle time txtalcyc 25 ns xin to sclk delay time tsclkdly 17.2 ns table 17-4. dma controller timing (v dd = 3.3 0.3v, t a = 0 to 70 o c, operating frequency = 40 mhz) parameter symbol min typ max unit ndreq hold time tdreqs 4.46 ns ndack delay time tdackd 2.62 ns table 17-5. iic interface timing (v dd = 3.3 0.3v, t a = 0 to 70 o c, operating frequency = 40 mhz) parameter symbol min typ max unit scl high level pulse width 100 khz tsclhigh 4.0 us 400 khz 0.6 scl low level pulse width 100 khz tscllow 4.7 us 400 khz 1.3 bus free time 100 khz tbuf 4.7 us between stop and start 400 khz 1.3 start hold time 100 khz tstah 4.0 us 400 khz 0.6 sda hold time 100 khz tsdah 0 us 400 khz 0 0.9 sda setup time 100 khz tsdas 250 ns 400 khz 100 stop hold time 100 khz tstos 4.7 us 400 khz 0.6
S3C3410X risc microprocessor electrical data 17- 11 table 17-6. memory interface timing (v dd = 3.3 0.3v, t a = 0 to 70 o c, operating frequency = 40 mhz) parameter symbol min typ max unit rom/sram address delay time t ad 13.41 ns rom/sram chip select delay time t csd 10.87 ns rom/sram read enable delay time t oed 10.44 ns rom/sram write enable delay time t wed 12.83 ns rom/sram write byte enable delay time t wbed 12.50 ns rom/sram read data setup time t rds 5.14 ns rom/sram read data hold time t rdh 0 ns rom/sram write data delay time t wdd 14.30 ns dram column address delay time t dcad 12.03 ns dram row address delay time t drad 11.28 ns dram ras delay time t drasd 11.76 ns dram cas delay time t dcasd 12.40 ns dram read enable delay time t doed 10.37 ns dram write enable delay time t dwed 12.02 ns dram(fp) read data hold time t pdrdh 2.18 ns dram(edo) read data hold time t edrdh 2.79 ns dram write data delay time t dwdd 11.23 ns sdram chip select delay time t scsd 16.25 ns sdram sras delay time t rasd 14.89 ns sdram scas delay time t casd 15.00 ns sdram address delay time t sad 13.27 ns sdram bank address delay time t bad 13.14 ns sdram a10 address delay time t apd 13.20 ns sdram data write delay time t sdwd 14.30 ns sdram data read hold time t sdrh 0 ns sdram write enable delay time t sdwed 14.83 ns sdram dqm delay time t dqmd 14.48 ns sdram scke delay time t scked 14.59 ns nwait setup time t wait 10 ns
electrical data s3c 3410x risc microprocessor 17- 12 notes
S3C3410X risc microprocessor mechanical data 18- 1 18 mechanical data overview the S3C3410X is available in a 128-qfp-1420 package. 128-qfp-1420 #128 20.00 0.20 22.00 0.30 14.00 0.20 16.00 0.30 0.15 + 0.10 - 0.05 0-8 0.10 max #1 note : dimensions are in millimeters. (0.75) 0.50 0.20 0.05 min 2.10 0.10 2.40 max 0.50 0.20 0.50 0.20 + 0.10 - 0.05 (0.75) 0.10 max 0.10 max figure 18-1. 128-qfp-1420 package dimensions
mechanical data S3C3410X risc microprocessor 18- 2 notes


▲Up To Search▲   

 
Price & Availability of S3C3410X

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X